March 24, 2010

Agile Branching Strategies

Agile
Branching
E-Commerce

Someone once asked me if adoption of Agile methods results in changing your branching strategy.  After several milliseconds of thought (and a dramatic pause for effect), I said, "No, not really."

Agile methodologies are all about process, and branching strategies are intimately tied to the development process.  It's reasonable to expect that adoption of agile methods results in changes to your branching strategy.  And indeed it does if you aren't already following branching best practices.

When it comes to applying agile concepts to branching strategies, I find that it doesn't lead to new branching patterns.  Instead, it encourages the use of particular branching patterns long considered optimal by SCM folks, long before "agile" became Agile.

So, what branching patterns and practices are in confluence with the goals of Agile?  Here are a few:

  • Follow the Mainline Model.
  • Maintain a stable, "mission-ready" mainline.
  • Follow the "Merge Down, Copy Up" model -- copying up to the mainline at the end of each sprint (a mini-release delivered frequently at regular intervals).

While there is no single branching strategy that is right for Agile, adopting agile methods will influence your branching strategy.  For example, agile methods call for the frequent delivery of small, testable chunks of functionality, or "sprints".  Keeping a stable mainline from which sprints are delivered helps make that happen.

You'll want to define an Standard Operating Procedure (SOP) that prescribes merge activities that occur at the end of each sprint.  This could be the "copy up" from a development branch to the mainline.  New development can originate in a set of development temporary project branches, optionally augmented by a permanent development branch.  The lifespan of a project branch could be thought of in terms of the number of sprint delivered from it.

Or, the culmination of a sprint could result in a copy up from the mainline to a more stable release branch from which the sprint deliverables are made available.  All sorts of variations are possible.