|
| 1 | +# Branching Strategy for releases |
| 2 | + |
| 3 | +## General Considerations |
| 4 | + |
| 5 | +- Generally the master branch is the one where current development is happening. |
| 6 | +- One objective would be to arrive to a point where the master branch can be released very often (every day?). |
| 7 | + This means the master branch is releasable at all times. I believe this strategy is called **Continuous Delivery**. |
| 8 | +- At this point we don't think it's possible to do that until the testing infrastructure has been improved. |
| 9 | +- Nevertheless, the branching strategy takes this objective into account. |
| 10 | +- To further support this objective, the strategy wil try to minimize the number of long-lasting branches. |
| 11 | + |
| 12 | +## Release numbering |
| 13 | +- example 4.3.0 |
| 14 | +- The first number (4 in this example) is incremented for major changes in the software. What major change mean has to be decided. |
| 15 | +- The second number (3 in this example) is incremented for minor changes in the software. |
| 16 | +- The third number (0 in this example) is used for maintenance releases. |
| 17 | + A maintenance is created if some bug has to be corrected before the next minor release. |
| 18 | + |
| 19 | +## Feature/fix branches |
| 20 | + |
| 21 | +- Feature/fix branch are created for every feature we want to add to the software (or bug we want to fix). |
| 22 | +- We will call them feature branches for the rest of this document. |
| 23 | +- They stem from master, are usually short-lived and are merged back to master. |
| 24 | + |
| 25 | +## Maintenance/release branches |
| 26 | +- In general we will try not to create long-lived release branches. |
| 27 | +- A long-lived release branch will be created only if any merge to master that came after the previous release is deemed not suitable to go in the maintenance release. |
| 28 | +- For example the change could be too extensive, or introduce an undue risk in the maintenance release. |
| 29 | + This is true in particular if the testing infrastructure is not sufficient. |
| 30 | + |
| 31 | +## Hotfixes |
| 32 | +- A hotfix will generally result in a maintenance release. |
| 33 | +- Hotfixes branches are similar to feature branches. |
| 34 | +- Where does the hotfix branch stem from: |
| 35 | + - Generally from the commit that was tagged for the latest release. |
| 36 | + - See for example commit A in the diagram. |
| 37 | + - In keeping with the **Continuous delivery** objective, we will allow the hotfix branch to stem from a commit |
| 38 | + downstream of the previous release commit if: |
| 39 | + - we consider that all merges coming from feature branches that happened after the previous release can go in the maintenance release. |
| 40 | + - For example if commit C from the diagram contains minor changes like typos we could decide that it's OK to include it in the maintenance release. |
| 41 | + - In that case the hotfix branch can stem from commit C and be merged back into master in commit F. |
| 42 | + - Commit F is tagged as the maintenance release and the maintenance release is built from there. |
| 43 | + - If a merge on the master branch cannot be included in the maintenance release (See for example commit I) then we have no choice but to create a maintenance branch |
| 44 | + - Create a maintenance branch stemming from the last commit of master that can go in the maintenance release. Commit F in our example. |
| 45 | + - After that, master cannot be merged into the maintenance branch, since it would introduce undesirable commits. |
| 46 | + - Also create a hotfix branch stemming from the same commit (commit F in our example) |
| 47 | + - Once fixed, merge the hotfix branch into the maintenance branch. This creates commit K, that should be tagged and used for the maintenance release. |
| 48 | + - Also merge the maintenance branch into master. |
| 49 | + - Do not delete the maintenance branch. It becomes a long-lived branch that can be used for further maintenance releases. |
| 50 | + - Merging into master creates commit L in the diagram. Note that at this point there could be conflicts so it becomes important to merge carefully. |
| 51 | + |
0 commit comments