I recently received a question from a customer who is dealing with the need to support multiple feature teams working on multiple releases in development. They asked how to structure branching to support this environment.
Background:
Recommended approach.
I would characterize your development model as Feature Team and your release model as Monthly Releases. The following illustration shows key concepts of this environment:
Each month, you do a full release of your entire web-site. In the illustration above, these monthly releases are marked v0.1, v0.2, v03, and so on. In the timeline above, one Feature Team works on developing features for the next release (vNext, or v0.1). At the same time, a second Feature Team begins working on developing features for vNext +1 (v0.2). At the end of the first month v0.1 is released and becomes vCurrent. Suring the second month, development continues on v0.2 (which is now vNext). In addition, a third feature team begins development on v0.4. During the second month, there is no development happening on vNext +1 (v0.3). But since vNext +2 is going to be a major release, development on vNext +2 (v0.4) begins in the second month, for planned release at the end of the fourth month on the timeline. At the end of the second month, vNext (v0.2) is released and becomes vCurrent. The vNext release is now v0.3 (but development has not begun on this minor release yet). The next major release is now vNext +1 (v0.4).
During the third month on the timeline, a new Feature Team begins development of the minor release, v0.3 (vNext). A second Feature Team began work on the next major release (v0.4, vNext +1) in the second month and continues this work during the third month. A new Feature Team begins development on the vNext +2 release (v0.5). Note that during the third month, there are three development teams working in parallel on v0.3, v0.4, and v0.5 (vNext, vNext +1, and vNext +2 respectively). At the end of the third month, the minor release (v0.3) is released and becomes vCurrent. The next release is now v0.4 (vNext), and v0.5 becomes vNext +1.
During the fourth month on the timeline, one Feature Team continues its work on v0.4 (vNext), while a second team continues its work on v0.5 (vNext +1). A new Feature Team begins work on vNext +2). At this time, there are three parallel teams working on v0.4, v0.5 and v0.n (vNext, VNext +1 and vNext +2 respectively. At the end of the fourth months, the major release, v0.4 is released and becomes vCurrent. The next release is now v0.5 (vNext) and v0.n becomes vNext +1.
During the fifth month on the timeline, two development teams work in parallel on v0.5 (vNext) and v0.n (vNext +1). At the end of the fifth months, v0.5 is released and becomes vCurrent. The next release is now v0.n (vNext).
The process continues as above. New Feature Teams can be formed, multiple Feature Teams can work in parallel on one or more future releases. One key is that each Feature Team must be working in their own branch so that their changes are isolated from the changes being made by other Feature Teams. A branching model to support multiple Feature Teams working on multiple releases is shown here:
To support the timeline described in the first illustration, only key branching an merging activities are shown on this branching model. There are likely to be additional merges (particularly from the Main branch to its child development (Feature Team) branches that are not shown in the second illustration.
Each of the key branch and merge activities is indicated with a node containing a letter (from A to W).
This is a description of these key activities:
A. The Main Branch is created. Initially it may not contain any source code.
B. In the first month, Main is branched to create a development branch for Feature (Development) Team 1.
C. Also in the first month, Main is branched to create a second development branch for Feature Team 2.
D. At the end of the first month, code for the next release (vNext, v0.1) needs to be merged to the Main branch for stabilization and then release. However, before merging the Feature Team 1 branch to Main (Reverse Integration from child to parent), it is important to do a final merge from Main to Feature Team 1 (Forward Integration from parent to child). Note- this FI merge is not shown in illustration two. After merging changes (if any) from Main to Feature Team 1, test the integration of the code from Main with the code in the Feature Team 1. Do this integration testing first in the Feature Team 1 branch. When the code in the Feature Team 1 is ready to be released, it can be merged to Main.
E. After the code from Feature Team 1 is merged (RI) with Main, it is stabilized in Main until it is ready for release. At this point, when Main passes quality gates, Main is branched to create the Release branch(es) for the next release (v0.1) which is now vCurrent. At this point, the Main branch can be freed up for stabilizing the next release (v0.2, vNext). Note the color change in the Main branch from blue to red takes place after the Release branch for v0.1 is created.
F. Continue doing daily builds in Main. Following a good daily build, merge Main with the Feature Team 2 branch (Forward Integration). Development continues during the second month in the Feature Team 2 branch.
G. During the second month on the timeline, create a new Feature Branch for Feature Team 3. Development on this branch is for a major release. It will continue for a couple of months and will be released at the end of the fourth month on the timeline.
H. At the end of the second month, the code in Feature Team 2 branch for v0.2 is released. As with version v0.1, code should only be merged from a development branch to the Main branch when:
I. Once the code in Main for vNext (v0.2) is stabilized and passes quality gates, it is ready to be released. Create the release branch(es) for v0.2, which now becomes vCurrent. The next release is now v0.3. J. As described earlier, the third release (VNext is now v0.3) is a minor release that does not require extensive development. A new Feature Team branch for vNext is created during the third month on the timeframe. K. In addition a new Feature Team branch for vNext +2 (v0.5) is created during the third month. Development on vNext +2 will take longer than four weeks (the normal release cycle, so development begins during month three). L. At the end of the third month, vNext (v0.3) is complete and ready to release. Follow the same steps described earlier for integrating changes from Main to this branch (FI), testing this integration, and then merging vNext to Main (RI). M. After vNext is stabilized, create a release branch for v0.3, which now becomes vCurrent. vNext is now v0.4. N. Main is now opened up for stabilizing vNext (v0.4). After each daily build in Main, merge Main (FI) with its child development branches (for example, vNext, v0.4) O. During the fourth month, work begins on vNext +2 (v0.n). Branch Main to create a Development branch for this release. P. At the end of the fourth month, development on vNext (v0.4) is completed, integrated with Main, and merged (RI) with Main. Q. After vNext is stabilized, create release branch(es) for v0.4, which becomes vCurrent. vNext is now v0.5. R. Main is now opened up for stabilizing vNext (v0.5). Merge Main with its child branches after each good daily build. S. At the end of the fifth month, vNext (v0.5) is merged to Main (RI) for stabilization. T. After vNext is stabilized, create release branches for v0.5, which is now vCurrent. U. Continue doing daily builds in Main. Main is now opened up for stabilizing vNext (v0.n). V. At the end of the month n, vNext is merged to Main (RI) for stabilization. W. After stabilizing v0.n in Main, create release branches for v0.n, which becomes vCurrent.
I. Once the code in Main for vNext (v0.2) is stabilized and passes quality gates, it is ready to be released. Create the release branch(es) for v0.2, which now becomes vCurrent. The next release is now v0.3.
J. As described earlier, the third release (VNext is now v0.3) is a minor release that does not require extensive development. A new Feature Team branch for vNext is created during the third month on the timeframe.
K. In addition a new Feature Team branch for vNext +2 (v0.5) is created during the third month. Development on vNext +2 will take longer than four weeks (the normal release cycle, so development begins during month three).
L. At the end of the third month, vNext (v0.3) is complete and ready to release. Follow the same steps described earlier for integrating changes from Main to this branch (FI), testing this integration, and then merging vNext to Main (RI).
M. After vNext is stabilized, create a release branch for v0.3, which now becomes vCurrent. vNext is now v0.4.
N. Main is now opened up for stabilizing vNext (v0.4). After each daily build in Main, merge Main (FI) with its child development branches (for example, vNext, v0.4)
O. During the fourth month, work begins on vNext +2 (v0.n). Branch Main to create a Development branch for this release.
P. At the end of the fourth month, development on vNext (v0.4) is completed, integrated with Main, and merged (RI) with Main.
Q. After vNext is stabilized, create release branch(es) for v0.4, which becomes vCurrent. vNext is now v0.5.
R. Main is now opened up for stabilizing vNext (v0.5). Merge Main with its child branches after each good daily build.
S. At the end of the fifth month, vNext (v0.5) is merged to Main (RI) for stabilization.
T. After vNext is stabilized, create release branches for v0.5, which is now vCurrent.
U. Continue doing daily builds in Main. Main is now opened up for stabilizing vNext (v0.n).
V. At the end of the month n, vNext is merged to Main (RI) for stabilization.
W. After stabilizing v0.n in Main, create release branches for v0.n, which becomes vCurrent.
As you can see, this is an iterative, incremental development process involving multiple feature teams working in parallel on multiple releases at the same time (vNext, vNext +1, vNext +2). At the end of each month, a new full release of the web site is released to the customer.
There are several keys to success when you are working on multiple future releases in parallel
The scenario described here has some similarities to Scrum. In this scenario there are monthly releases that somewhat correspond to Sprints in a Scrum project. There are some key differences: