|
| 1 | +# Branching Strategy for releases |
| 2 | + |
| 3 | +## General Considerations |
| 4 | + |
| 5 | +- Generally the master branch is the one where current development is happening. |
| 6 | +- For the sake of simplicity, one objective would be to minimize the number of long-lived branches, for example branches dedicated to maintenance releases. |
| 7 | + |
| 8 | + |
| 9 | +## Release numbering |
| 10 | +- example 4.3.0 |
| 11 | +- The first number (4 in this example) is incremented for major changes in the software. |
| 12 | + - A major change impacts the rules, either errors or warnings OR includes breaking changes for users. |
| 13 | +- The second number (3 in this example) is incremented for minor changes in the software. |
| 14 | + - A minor change is non-breaking for users, and doesn't impact validation rules. |
| 15 | +- The third number (0 in this example) is used for maintenance releases. |
| 16 | + - A maintenance is created if some bug has to be corrected before the next scheduled release. |
| 17 | + - As an example see [#1663](https://github.com/MobilityData/gtfs-validator/pull/1653) in the gtfs-validator repository. |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | +## Feature/fix branches |
| 22 | + |
| 23 | +- Feature/fix branch are created for every feature we want to add to the software (or bug we want to fix). |
| 24 | +- They stem from master, are usually short-lived and are merged back to master. |
| 25 | +- We already use these for adding features or fixing bugs in the master branch. |
| 26 | + |
| 27 | +## Maintenance/release branches |
| 28 | +- In general we will try not to create long-lived release branches. |
| 29 | +- 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. |
| 30 | +- For example the change could be too extensive, or introduce an undue risk in the maintenance release. |
| 31 | + - This is true in particular if the testing infrastructure is not sufficient, meaning it's more difficult to know if a change is safe. |
| 32 | + |
| 33 | + |
| 34 | +## Hotfixes |
| 35 | +- We should strive to not do hotfixes, but sometimes it's inevitable. |
| 36 | +- A hotfix will generally result in a maintenance release. |
| 37 | +- Hotfixes branches are similar to feature branches, but we should consider using the prefix `hotfix:` for such issues and PRs. |
| 38 | +- Where does the hotfix branch stem from: |
| 39 | + - Generally from the commit that was tagged for the latest release. |
| 40 | + - See for example commit A in the diagram. |
| 41 | + - In keeping with the **Minimize Branching** objective, we will allow the hotfix branch to stem from a commit |
| 42 | + downstream of the previous release commit if: |
| 43 | + - we consider that all merges coming from feature branches that happened after the previous release can go in the maintenance release. |
| 44 | + - 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. |
| 45 | + - In that case the hotfix branch can stem from commit C and be merged back into master in commit F. |
| 46 | + - Commit F is tagged as the maintenance release and the maintenance release is built from there. |
| 47 | + - 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 |
| 48 | + - Create a maintenance branch stemming from the last commit of master that can go in the maintenance release. Commit F in our example. |
| 49 | + - This branch becomes a long-lived branch that can be used for further maintenance releases and should be protected from deletion. |
| 50 | + - This branch should require pull request do add commits to it. |
| 51 | + - After that, master cannot be merged into the maintenance branch, since it would introduce undesirable commits. |
| 52 | + - Also create a hotfix branch stemming from the same commit (commit F in our example) |
| 53 | + - Once fixed, merge the hotfix branch into the maintenance branch. This creates commit K, that should be tagged and used for the maintenance release. |
| 54 | + - Also merge the maintenance branch into master. |
| 55 | + - Do not delete the maintenance branch. It can be used for further maintenance releases. |
| 56 | + - 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. |
| 57 | + |
0 commit comments