Recipe 2.6 Finishing a hotfix branch
Problem
You have fixed the production issue on the HotFix branch.
Solution
When finished, the bugfix needs to be merged back into master, but also needs to be merged back into develop, in order to safeguard that the bugfix is included in the next release as well. This is completely similar to how release branches are finished.
- Update master and tag the release.
$ git checkout master
$ git merge --no-ff hotfix-1.2.1
$ Git tag -a 1.2.1
- Include the bugfix in develop.
$ git checkout develop
$ git merge --no-ff hotfix-1.2.1
- Remove the temporary hotfix branch.
$ git branch -d hotfix-1.2.1
Discussion
When a release branch currently exists, the hotfix changes need to be merged into that release branch, instead of develop. Back-merging the bugfix into the release branch will eventually result in the bugfix being merged into develop too, when the release branch is finished. (If work in develop immediately requires this bugfix and cannot wait for the release branch to be finished, you may safely merge the bugfix into develop now as well).