-
Notifications
You must be signed in to change notification settings - Fork 20
Hotfixes
Hotfixes are landings on the master
branch which happen outside of the regular development on develop
. They are merged back to develop
as well.
The purpose of a hotfix is either:
- to land a bustage fix when an earlier merge to
master
broke something on production, or - to land a small and much needed feature off-cycle, without having to merge and deploy the entire
develop
branch.
Assume that after we merged develop
to master
and pushed to production, an issue is discovered, and bug 600000 is filed.
$ git flow hotfix start 600000-missing-import
Switched to a new branch 'hotfix/600000-missing-import'
Summary of actions:
- A new branch 'hotfix/600000-missing-import' was created, based on 'master'
- You are now on branch 'hotfix/600000-missing-import'
Follow-up actions:
- Bump the version number now!
- Start committing your hot fixes
- When done, run:
git flow hotfix finish '600000-missing-import'
Refer to the Contribute page for instructions on how to make changes, commit them and create patches. Here's a quick recap:
# ...write code...
git add manage.py
git commit -m "Add a missing import"
git diff master...HEAD > patch.diff
# ...attach the patch on bugzilla and get review...
Rinse and repeat until you get a r+.
If you've made more than one commit, you'll want to squash then into a single one.
$ git rebase -i master
Change
pick 458dbf5 Add a missing import
pick b7e73d8 Explicitly import datetime.datetime
to
pick 458dbf5 Add a missing import
fixup b7e73d8 Explicitly import datetime.datetime
(Note the fixup in the second line.)
$ git commit --amend
The final commit message should include:
- the bug number
- short summary of the changes made on the feature branch
- reviews (e.g. r=stas)
- (optional) longer description separated by a blank line.
Example:
Bug 600000 - Add a missing import, r=stas
The manage.py file requires the datetime module to be installed.
You're ready to merge your hotfix branch onto master
and develop
.
$ git flow hotfix finish -n 600000-missing-import
Switched to branch 'master'
Merge made by recursive.
manage.py | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Switched to branch 'develop'
Merge made by recursive.
manage.py | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Deleted branch hotfix/600000-missing-import (was 31565e0).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Hotfix branch has been merged into 'master'
- Hotfix branch has been back-merged into 'develop'
- Hotfix branch 'hotfix/600000-missing-import' has been deleted
Note the finish -n in the flow command. This will prevent git flow from automatically tagging the merge commit on the master
branch. We do this because the tag naming scheme used by git flow is to use the name of the hotfix branch, which isn't really what we want. We will tag ourselves in the next step.
When tagging, remember to use git tag -a, which will create an annotated tag object (as opposed to a lightweight tag created by git tag).
The name of the tag depends on whether you're doing a bustage fix, or are trying to land a feature off-cycle.
Use the last release's tag and append .x
to it, where x
is the smallest integer available. Example:
$ git tag -a 2011-05-23.1 master
Tag this as a regular release, i.e. with a date. Example:
$ git tag -a 2011-05-24 master