For my .NET project containing several class libraries, I am currently using the following git branching strategy:
feature 1
+------------+
^/ \
master / v
----------+-+---+---------- PR ----+------+-----------
\ \ \ \
\ v release/7.0 \ v
\ +------------------ \ ----+--------- I branched from master and set the "version" to 7.0.0, 7.0.1, ... The aspnetcore package versions also point to 7.x.x
\ \
v release/6.0 v
+----------------------+------------- I branched from master and set the "version" to 6.0.0, 6.0.1, ... The aspnetcore package versions also point to 6.x.x
However, doing it like this prevents me from properly updating .NET versions on the master branch, since these changes would also need to be merged into the release branches. So the master branch would always be out-of-date.
I've read about GitFlow, but it's unclear to me how this solves the problem of version changes in the master branch being merged to all release branches.
If I use SourceTree to check the branch graph for asp.net core, I see that the main
branch is never actually merged into the release/6.0
and release/7.0
branches, but commits still end up on these branches:
The version was changed in the main
branch to 8
, but these changes don't propagate to the other release branches.
I've already read several resources in the past, but couldn't get an answer. So how do I properly organize my git repository in order to do versioning the right way?
EDIT
It seems that for angular, commits on the main branch manage to end up in the release branches, without actually merging them. But I'm wondering how they do this. The commit timestamp is 2 seconds apart, so I don't think they cherry-pick it manually
QUESTIONS:
- So when/where does the release process replace
0.0.0-PLACEHOLDER
with the actual version, and where does that come from? Also, how do they map the corresponding dependency versions in that stage? - Are angular/asp.net core/... using git-flow? Or how do they manage multiple major versions next to one another?
- Where is the version number coming from?
It seems to me that I'll have to change the version (+ the versions of the dependencies) on the master, and mark the commit to be skipped when merging into release branches... But is that feasible to do?
EDIT 2
LinkedIn posted an article on their dev blog about this, which points to an app to automate cherry-picking and creates pull requests. But there seem to be several github actions too.
Even google created a github bot to create pull requests to cherry-pick commits into release branches