Branching in source control musings

October 5, 2007

Every week I’ll be looking to share a particular topic that I’ve been thinking about usually based on a post from an interesting blog or article.

This week, the post that got me thinking the most was one on the coding horror blog entitled Software Branching and Parallel Universes.

In the current environment I’m working in there is no branching involved – all code is developed in the same common code and exclusive checkouts are used to ensure that no cross-over or interference occurs. This limits the opportunity for parallel development, but to be honest that isn’t really a factor with so many products for us to maintain at any one time – that is probably the defining factor in the lack of branching use.

That’s not to say it hasn’t been discussed and that initial discussions haven’t taken place on it. Unfortunately most of these discussions haven’t evolved into anything concrete, but perhaps the Coding Horror post will spark something into life for us.

Branch per Task
Every development task is a new, independent branch. Tasks are merged into the permanent main branch as they are completed.

This is probably the most appropriate to my current environment – we have internal web site projects (many of them!) that don’t really version… they get enhanced as new functionality is plugged in or change requests are developed and implemented.

A task orientated approach may prove very useful but it brings back questions that we have faltered on before (and effectively given up on).
Say we have a website – websiteA – and this has 5 common core class library projects that it shares with up to 10 other sites. A change request may result in a branch being created for websiteA-Change1045 (as an example) and this can be worked on in isolation.
However, invariably some changes require the common code to be improved upon in some way and here we will also have to branch each and every component library we wish to modify. Without a clear branching strategy we can see that this could get ugly.. especially as simply typing inside a file in VS2005 automatically checks out the file behind the scenes with no confirmation request.. this would be very easy to do on the existing “release/original” code for those libraries in source control.

I guess it is all about thinking ahead with that clear branching strategy and also what advantages this gives to the build features of Team Foundation Server that we currently use.
At present we cannot build to a UAT environment automatically due to the nature of the check-ins happening on the common code (they often occur post-development but pre-full integration testing).

On a lighter note, the post also suggests thinking about branching in terms of parallel universes:

Perhaps the most accessible way to think of branches is as parallel universes. They’re places where, for whatever reason, history didn’t go quite the same way as it did in your universe. From that point forward, that universe can be slightly different– or it can be radically and utterly transformed.

One of the recent definitive parallel universes is the Star Wars Infinities series from Dark Horse Comics.
It is silliness in a world that is revered by many and is a recommended read if not solely for it’s boldness in taking on the canon pedants.


One comment

  1. You should look at AccuRev SCM with its stream-based architecture with built in inheritance. It will certainly make ‘branching’ much more simplified…if you can call it that. Changes can be set up to automatically propogate to other child streams, and a patch fix in one can be easily applied to parent/child streams in others making sure nothing is less to chance. Definitely architected for people who do massive parallel development when working off the mainline is not an option.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: