Suppose I have 2 features to be delivered (A and B). I have two primary branches (develop & master) for staging and production servers and 2 feature branches (features/a and features/b). When a feature is ready, I merge it to develop branch for testing. Let's assume that there wasn't found any bugs in feature A but there are some bugs in feature B, so I can't merge develop to master since feature B requires some fixes. But I need to deliver features that are ready (A in this case), so this approach doesn't work here. What other approaches can I try? I cannot switch branches for testing server because each feature may change the database schema, and I cannot always revert schema changes. I also cannot recreate database every time because I lose all the test data added manually by testers.

有帮助吗?

解决方案

In case there are no dependencies between the developed features you can use git cherry-pick to merge the commit(s) of one feature branch to the final master branch.

However, you should consider to introduce release branches to decouple the development branch from the master branch to avoid any misplaced/unpleasant commits in the final master branch.

Hence the workflow would be, developing in feature branch, merge to development branch, verifying, if okay, merge to release branch, if not okay, fix on feature branch. Finally, merge from release branch to master branch.

A release branch is also useful when some new features are ready which are not part of the current release but part of the next release. Then you have a release branch for the current release and one for the next release.

许可以下: CC-BY-SA归因
scroll top