|
1 | 1 | # Mainline development
|
2 |
| -Mainline development is enabled when using [GitHubFlow](../git-branching-strategies/githubflow.md) or any other strategy where you develop on `master`. The main rule of mainline development is that **master is always in a state that it could be deployed to production**. This means that pull requests should not be merged until they are ready to go out. |
| 2 | +Mainline Development is enabled when using |
| 3 | +[GitHubFlow](../git-branching-strategies/githubflow.md) or any other strategy |
| 4 | +where you develop on `master`. The main rule of mainline development is that |
| 5 | +**master is always in a state that it could be deployed to production**. This |
| 6 | +means that pull requests should not be merged until they are ready to go out. |
3 | 7 |
|
4 |
| -To properly achieve mainline development you need confidence in your test suite as if it goes green against a PR then you are confident that you can merge and release that pull request. Another property of mainline development is normally that you fix going forward, not revert. When an issue is discovered with a release, add a test or some sort of check to make sure it won't happen again, fix the issue, then do a release with the fix. |
| 8 | +To properly achieve mainline development you need confidence in your test suite |
| 9 | +as if it goes green against a PR then you are confident that you can merge and |
| 10 | +release that pull request. Another property of mainline development is normally |
| 11 | +that you fix going forward, not revert. When an issue is discovered with a |
| 12 | +release, add a test or some sort of check to make sure it won't happen again, |
| 13 | +fix the issue, then do a release with the fix. |
5 | 14 |
|
6 |
| -Like all things, it is an approach and will work for some people and not for others. GitVersion is unique in the fact that it works very well with mainline development and the version numbers it generates are *predictive* and indicate what the next version to be released is. Most other approaches require bumping the version number before the release which means that the version being built and the version number which will be deployed are often different. |
| 15 | +Like all things, it is an approach and will work for some people and not for |
| 16 | +others. GitVersion is unique in the fact that it works very well with mainline |
| 17 | +development and the version numbers it generates are *predictive* and indicate |
| 18 | +what the next version to be released is. Most other approaches require bumping |
| 19 | +the version number before the release which means that the version being built |
| 20 | +and the version number which will be deployed are often different. |
| 21 | + |
| 22 | +This mode is great if you do not want to tag each release because you simply |
| 23 | +deploy every commit to master. The behaviour of this mode is as follows: |
| 24 | + |
| 25 | +1. Calclate a base version (likely a tag in this mode) |
| 26 | +2. Walk all commits from the base version commit |
| 27 | +3. When a merge commit is found: |
| 28 | + - Calculate increments for each direct commit on master |
| 29 | + - Calculate the increment for the branch |
| 30 | +4. Calculate increments for each remaining direct commit |
| 31 | +5. For feature branches then calculate increment for the commits so far on your |
| 32 | + feature branch. |
| 33 | + |
| 34 | +If you *do not want* GitVersion to treat a commit or a pull request as a release |
| 35 | +and increment the version you can use `+semver: none` or `+semver: skip` in a |
| 36 | +commit message to skip incrementing for that commit. |
| 37 | + |
| 38 | +Here is an example of what mainline development looks like: |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +**WARNING:** This approach can slow down over time, we recommend to tag |
| 43 | +intermitently (maybe for minor or major releases) because then GitVersion |
| 44 | +will start the version calculation from that point. Much like a snapshot in an |
| 45 | +event sourced system. We will probably add in warnings to tag when things are |
| 46 | +slowing down. |
0 commit comments