If you try to follow the git-flow branching model, documented here and with tools here, how should you handle this situation:
You have made a 1.0 release and a 2.0 release. Then you need to make a hotfix for 1.0. You create a hotfix branch off the 1.0 tag and implement the fix there. But what then?
Normally you would merge to master and put a 1.1 release tag there. But you can't merge 1.1 to a point after 2.0 on master.
I guess you could put the release tag on the hotfix branch, but that would create a permanent branch beside the master that would contain a release tag. Is that the right way?
Properties of the Gitflow hotfix No feature enhancements or chores are allowed on the Gitflow hotfix branch. The hotfix branch merges into both master and develop branches when its lifecycle ends. The hotfix branch is deleted after it is merged or rebased into master and develop branches.
Hotfix branches As soon as the fix is complete, it should be merged into both main and develop (or the current release branch), and main should be tagged with an updated version number. Similar to finishing a release branch, a hotfix branch gets merged into both main and develop.
Gitflow release branch process overview The release branch represents a complete feature set. The only commits on the release branch are for bug fixes and important chores. The Gitflow release branch is created off the development branch. Gitflow release is merged into master and also back into development.
Git flow is a popular Git branching strategy aimed at simplifying release management, and was introduced by software developer Vincent Driessen in 2010. Fundamentally, Git flow involves isolating your work into different types of Git branches.
It seems that there is a concept of a "support" branch in git flow. This is used to add a hotfix to an earlier release.
This thread has more information, with these examples:
git checkout 6.0 git checkout -b support/6.x git checkout -b hotfix/6.0.1
... make your fix, then:
git checkout support/6.x git merge hotfix/6.0.1 git branch -d hotfix/6.0.1 git tag 6.0.1
or using git flow
commands
git flow support start 6.x 6.0 git flow hotfix start 6.0.1 support/6.x
... make changes then:
git flow hotfix finish 6.0.1
Interesting question! The flow you linked assumes master can track production. That only works if production versions are strictly increasing. That's typically true for a website which has only one production version.
If you have to maintain multiple production versions, one branch to track production is not enough. A solution is not to use master to track production. Instead, use branches like release1
, release2
, etc.
In this approach, you may not even need a hotfix branch. You could fix the problem on the release1
branch. When the fix is good enough, create a release1.1
tag on the release1
branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With