Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a good branching strategy when developing several future releases at once?

The past

I develop a software project using subversion as an scm. Until now, development always happened in trunk, so problems arose when a bugfix release was necessary. Now, we want to rethink our branching strategy and the requirement is: We want to be able to work on multiple future releases at once.

The task

That means: Assume, the current version we are working on is 1.0. The next planned version is 2.0, the version after that is 3.0. Now that we have released 1.0 we want to

  • maintain version 1.0
  • develop features for 2.0
  • at the same time develop features for 3.0

Of course, fixes that have been applied in 1.0 are also needed in the other two versions. Furthermore, features from 2.0 will also have to be in 3.0. Also, it might be possible that a minor release is planned, say 1.1 that also includes new features and will have to be maintained separately.

A possible solution

I came up with the following branching strategy:

  • The trunk will be abandoned
  • For each new planned release, a branch is created which stems from the last release branch
  • Changes are propagated "upwards" in the version timeline

Let me elaborate this a bit more: In the given example, we would branch version 1.0 from trunk. Also, we would branch version 2.0 from version 1.0 and version 3.0 from version 2.0. When a change is made in 1.0, it will be merged into 2.0 and subsequently into 3.0.

Visualization of the described branching strategy (please excuse the crappy paint quality)

The question

Is this a valid methodology? Will it work technically? Are there organizational pitfalls? Are there best practices? (All the internet would come up with is: "Develop in trunk, maintain in release branch"). It especially seems strange to me to abandon trunk -- is that wrong?

like image 454
David Avatar asked Nov 05 '22 01:11

David


1 Answers

The idea of "developing in trunk" comes from the fact trunk is the default branch you can want to checkout.
I.e: you have no idea of the naming convention for the other branches, but you know at least that the "main" branch is called "trunk", so as a new developer, you can be tempted to checkout that one, which is why the current development is best made in that same branch.

The branches 1.0, 1.1 or 2.0 would rather be for maintenance operations, once those releases has been done.

For parallel development, I would recommend another naming convention, like 1.1_dev, 2.0_dev, made from the trunk (which would represent the current 1.0 development).
That can work provided those branches aren't too much long lived, and that they don't diverge too much from trunk (because of merges which would become increasingly complex otherwise).

like image 143
VonC Avatar answered Nov 10 '22 15:11

VonC