End-of-release Branching Strategies

Part 1: Branches and Code Lines

of a single integration point, agile teams use a variation of the main line pattern called an active development line, which is structurally like the main line-a single code line-but with policies that help to ensure that the code line is always at a certain level of quality. Some of these policies include writing and running automated tests before committing changes and setting up a continuous integration process that validates the code compiles and runs all tests successfully.

Firmness of Code Lines
In her book Practical  Perforce , Laura Wingerd describes the Tofu Model for how change should  flow between branches.  In this model, release  branches are "firmest" and task branches are  least firm, with the main  line in the middle. Change flows from firm code lines to softer ones, so the main line should continuously take changes from the release branch, but change should not flow the other way around. This ensures stability of the code lines.

Figure 2: Common code line structures

There are alternatives to the agile, active development line approach, but in the end they defer problems. Your team can make more progress by helping to keep the development stream working both by exercising a reasonable amount of care before commits and also working together to immediately fix problems that might have slipped by.

Release Branches
Regardless of your development approach, it is often necessary to provide an urgent fix to code that is being used by customers without introducing additional features or functionality.

In spite of your desire to maintain shipping code, it will take time to get your team and your process to a point where you can reliably ship from the main line, so branching at or near the end of a release may be useful. This requires a parallel development stream. This development stream can evolve into a release branch that will allow you to easily fix critical issues that can't wait until the next release, so teams have processes in place to integrate these changes back into the main line by merging.

In part two of this article, I'll discuss some approaches to using your branching as a way to help you to deliver a solidly-tested product, while at the same time allowing you to begin new work while the release is being finalized.

What's In a Merge?
Version management tools can be very helpful in tracking which changes have not been merged between code lines. In some cases this is useful, especially close to the time a branch is created. There are many other situations when a literal merge isn't appropriate. Examples  include:
  • A change does not apply to new code because of business rules. You might make a change in a release branch to solve a problem in the current release, but it won't apply once the next release ships.
  • A change does not apply to new code because structure has changed. For example, the main line may have changed component structure, thus making the code changes moot. The main line may still need to integrate the functionality but in a different  place. In this case, tests may migrate from branch to main line.

Merging isn't just a mechanical process. This is one reason why changes are best merged  either by or in collaboration with the person who made the original change.

About the author

Steve Berczuk's picture
Steve Berczuk

Steve Berczuk is an engineer and ScrumMaster at Humedica where he's helping to build next-generation SaaS-based clinical informatics applications. The author of Software Configuration Management Patterns: Effective Teamwork, Practical Integration, he is a recognized expert in software configuration management and agile software development. Steve is passionate about helping teams work effectively to produce quality software. He has an M.S. in operations research from Stanford University and an S.B. in Electrical Engineering from MIT, and is a certified, practicing ScrumMaster. Contact Steve at steve@berczuk.com or visit berczuk.com and follow his blog at blog.berczuk.com.