问题
I am trying to introduce Git flow to my team. We are a fairly small team and quite agile. We want to release once a day and this means we have limited time towards testing all the changes in the day. Business team wants to be able to control the features that are getting released although its not ideal.
Git flow doesn't seem to accommodate this very well. After cutting a release branch from develop what is the best way to merge selected features to master. Is cherry picking the only option? Is there a better way?
回答1:
The standard git flow
handling is not ideal if the business team wants to control which features are in the next release. But you will have the same problem with other branching mechanisms.
The default structure for git flow
is that you create a feature branch for each new feature. Once you have finished building (and testing) the new feature, you merge the branch back into your develop branch and then remove the feature branch. Then the feature will be included in the next release.
If a feature should not be included in the next release, you should not merge the feature branch back into the develop branch. That is the best way to make sure it will not be included. It also prevents other developers from creating code that uses (or otherwise requires) the new feature.
I would not recommend cherry-picking. First, a feature can (and frequently will) have multiple commits and it is easy to forget one. Second, if feature B uses code that was added in feature A, and management wants to release feature B without releasing feature A, you're likely to find that feature B is broken. And those dependencies are not always easy to spot.
It makes sense that management wants to prioritize new features, but each feature should be merged back into the develop branch soon after it has been completed (and tested).
回答2:
If each feature has its own branch, simply merge that feature branch.
来源:https://stackoverflow.com/questions/13887454/git-flow-releasing-selected-features