I've been looking into trunk based development recently (https://trunkbaseddevelopment.com) and what we do fits the approach nicely (small team, frequent releases, some direct commits or short-lived branches, etc.).
The only struggle I have is tagging the releases. We do CI but not every coming goes to production, and we want to increment (change) the version once the code is shipped to the customer's environment.
How in the trunk bases development (in an idiomatic way) should I do a release? How you feel with release commits on master? I can see two approaches (I'm using Java + Maven bit that's just tooling that should come in the way).
Approach #1
- //version information in trunk: 'SNAPSHOT'
- git checkout -b release/1.11
- // update version on release branch and commit
- // build the complete project and release
- git checkout master
- // continue with features
Approach #2
- // version information in trunk: '1.11-SNAPSHOT'
- git branch release/1.11
- // update version on the master branch to 1.12-SNAPSHOT'
- git checkout release/1.11
- // update version on release branch to '1.11' and commit
- // build the complete project and release
- git checkout master
- // continue with features
The second approach leaves a single commit in the repository's history, which I'm not sure how to feel about. The latter approach makes the code slightly more traceable and the release process a bit easier.
On a side note, I don't much care about bugfixes, etc. We do release a new version. But if a hotfix is required, we plan to cherry-pick