Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is merging feature branches into release branches a bad idea?

We have adopted the branching model proposed by Vincent Driessen and we do nearly everything as he has described in his article.

Only when it comes to handling release branches we deviate a bit.

Vincent proposes to develop features in branches which are branched from the developer. When it is decided which features come into the next release, they are merged back into the developer and a release branch is created from it.

After that the feature branch should only be used for testing and bugfixing. When the release is deployed to live, the release branch is merged back into developer and master.

What we do instead is to merge features directly into the release branch: realease branch modelling

I feel that this is not the way it should be done and I'm trying to think of cases where this could actually make things more complicated.

One I can think of is the following:

Let's say a new Feature c is building upon Feature a, which is already merged into a release branch. I have to first merge the release branch back into the developer to be able to create a new Feature c branch from developer.

Are there other cases where this branching model could make things more complicated?

like image 814
Zounadire Avatar asked Jul 15 '13 12:07

Zounadire


1 Answers

One case I could think of, where this can make thing go complicated is that it will start blocking further development.

Consider you are developing a feature A, which will go immediately on your next release. Now there is another development team which will be working on feature B, which is heavily dependent on feature A, but it needs to be in release only after a couple of sprints. So, obviously we will branch out feature B from feature A.

Now, you find a bug in feature A, your release for feature A is approaching fast, you have two options a hot-fix/hack or a proper code re-factor and fix.

With time as constraint, its wise to have hot-fix, but considering future we need proper re-factor and fix.

Happy news is that we can go for both.

With your strategy (from what I understand) your release branch, will receive all the patches and hot-fixes(contains 5+ commits) as you can't commit anything like that to feature A (if you are strict on policies). Consider the number of such fixes release will be having if you have 10+ features at once.

But with Vincent Driessen's strategy there is always development branch as a stash between your feature and release, so for such hot fixes you can merge back to development branch and then branch out from there for the hot fixes and then merge back to development and then to release. And you have advantage of not having the hacks/hot-fixes anywhere in your feature branch. Further features based on the feature can continue parallel. And you can abandon the hotfixes branches or remove from history. This only one view-point and probably you can defend your strategy in this case. I am open for further discussions and corrections in my answer :)

And here is a pretty nasty image depicting what I am conveying. Git Branching Diagram

like image 119
egghese Avatar answered Oct 06 '22 00:10

egghese