Saturday, April 21, 2007

To Branch Or Not to Branch

The other day I was working on a guidance document for branching strategy in Team Foundation Server. When we looked at some of the customer references, we realized that a fantastic feature like branching is misused more than often. Talking to number of customers we realized some or the other time Configuration Managers and Developers come face to face with the dilemma, To Branch or not to branch?

The answer to this question is, you should not branch!! For many simple scenarios, you don't need to branch and labeling your builds is sufficient. Because with branching merging comes into the picture, the complexity of branching increases the pain of merging exponentially. Said that, you should branch only when you have to isolate parallel development efforts. Here are few common scenarios which gives insight as to when and how you should branch.
  • If you are working on one release at a time, then you just don't need to branch, just work from your main trunk.
  • If you want parallel development while you prepare for intermediate release and need to stabilize the release build, then you need to branch the release source code. Do testing / bug fixing on the release branch and parallel development on the main trunk. Once the release is done, you might / or might not want to merge the bug fixes to the main trunk.
  • If you have to make a patch or hotfix on an old release with parallel development for a new release, then, you branch the old release. Do testing / bug fixing on the patch / hotfix release and parallel development on the main trunk. Once the patch or hotfix is done, you might or might not want to merge the bug fixes to the main trunk
  • If you are having regular problems with broken builds, then a create development branch to isolate parallel development efforts. Merge the development regularly with the main trunk, which can be used for stabilized build.
  • If you have features which can be worked in parallel, but might cause stability among each other, then branch the main trunk for each feature development. Merge the feature branches regularly into the main branch and reverse merge for features to share code. The main branch is used for stabilized build.
These are the very basic scenarios, and depending upon your team you can have combination of more than one scenarios. Thumb of rule to follow is avoid branching, and branch only when you have to do parallel development.

There is a good document - Explained: Branching in Team Foundation Server, which gives insight on the branching strategy.

So no more, To branch or not to branch dilemma.

~Later

2 comments:

Mazhar said...
This comment has been removed by the author.
Anonymous said...

Interesting post as for me. It would be great to read more about this matter. Thanx for sharing this info.
Sexy Lady
UK escort