Over the last few years I have worked with teams that feel a need to using Branching as part of their “best practices” tool set. The ALM Rangers were even nice enough to show teams how to build a mature branching scenario in their Visual Studio Team Foundation Server Branching Guide 2010. PROCEED WITH CAUTION! There is a large overhead in using branching and merging. The branching part is easy, it’s the merging part that will kill you. Done infrequently, the merge process can be a huge undertaking in many cases taking days to complete. Here is a quote from the original VS 2005 Branching and Merging Primer:
A branching and merging strategy involves a tradeoff between risk and productivity. You trade the safety of working in isolation for the increased productivity of working with other people. The productivity increases come with a cost—the additional effort required for merging software assets sometime in the future.
Often, there is no need to adopt branching as the teams are small enough or using shelves will suffice. If you feel you need to branch, do so for the right reasons. What are the “right reasons?” In a nutshell, you absolutely NEED to isolate some code from other teams/repositories. Examples might include:
- Development on a new feature is continuing while the current version is releasing. (branch by feature)
- Teams are practicing design by contract and only want the final contract to be used by other teams. (branch by team)
What are some branching and merging anti-patterns to watch for? Here are few (thanks Chris Birmele):
- Merge Paranoia—avoiding merging at all cost, usually because of a fear of the consequences.
- Merge Mania—spending too much time merging software assets instead of developing them.
- Big Bang Merge—deferring branch merging to the end of the development effort and attempting to merge all branches simultaneously.
- Never-Ending Merge—continuous merging activity because there is always more to merge.
- Wrong-Way Merge—merging a software asset version with an earlier version.
- Branch Mania—creating many branches for no apparent reason.
- Cascading Branches—branching but never merging back to the main line.
- Mysterious Branches—branching for no apparent reason.
- Temporary Branches—branching for changing reasons, so the branch becomes a permanent temporary workspace.
- Volatile Branches—branching with unstable software assets shared by other branches or merged into another branch.
Note Branches are volatile most of the time while they exist as independent branches. That is the point of having them. The difference is that you should not share or merge branches while they are in an unstable state.
- Development Freeze—stopping all development activities while branching, merging, and building new base lines.
- Berlin Wall—using branches to divide the development team members, instead of dividing the work they are performing.
Remember, think long and hard about jumping into branching and merging.
Some additional reading: