I'm feeling a bit confused about how to effectively manage git branches within Git Flow. I spoke with a colleague from another team who uses Git Flow, and I get the concept of creating a feature branch off of develop, then merging that feature back into develop when it's finished. However, I'm puzzled about how to handle situations when there are multiple features in the develop branch that aren't ready for release. For instance, let's say I have features A, B, and C already in develop, and I create a new branch for feature D. If I want to release only features A and D, while B and C are still in progress, how can I achieve this? Is cherry-picking the best option, since I can't merge feature D back into develop due to the other unfinished features? How do I isolate features properly in this workflow?
2 Answers
You're right in thinking that separating features is crucial. A common approach is to use feature flags or toggles both in development and in production, which allows you to hide incomplete features while still deploying other features. It's also helpful to ensure that the develop branch is always stable by not allowing any unstable features to be integrated there. If you have a backlog of features not ready for release, perhaps consider a different approach like creating a staging branch where only tested features can exist until you're ready to release.
From what I've learned, during your development process, you should aim to have your feature branches isolated completely from each other. In Git Flow, ideally, a feature branch should only contain code that's ready for production. To handle your situation, if features A, B, and C are in develop and not finished, you shouldn't merge them back into your new feature branch D. Instead, keep D isolated until it's ready. If A is ready to go and only D should be released, consider creating a release branch from develop, but only merge A back into it for deployment. This way, features in testing won't affect your release. If you need to cherry-pick changes, make sure to choose the specific commits for features that are stable and ready for release.
That makes sense! So keeping feature branches separate and only merging stable features into release is key. Thanks for clarifying!
Using feature flags sounds interesting! It seems like that could help mitigate the conflicts and let you manage your releases better.