When hotfixes need to be applied and deployed to production:
- Make sure that the hotfix branch is branched off from the
production
branch and not thedevelopment
branch. - Send a pull request for the
production
branch. Theproduction
branch isn't protected for merges like thedevelopment
branch, so you can merge them yourself (useful in cases of emergency and no one us there to approve your PR) but if possible, as someone to merge the code for you. - Send a pull request to the
development
branch so the pull request exists in both branches. - In case the PR does not merge cleanly with
development
please branch off from the hotfix branch, fix the merge conflicts, and then merge that intodevelopment
Note that the production
branch doesn't need to have its own canonical history; only development
has that property. This means that in case the production
branch becomes fully out of sync with development
it is not forbidden to just delete "bad" production
branch and just recreate it from development
.
Some illustrations:
Branch the hotfix off of production
+<<<<<<<<<<<<<<<+<<<<hotfix
| | |
| | /
| | /
| | /
| | /
| | /
| |/
| +
development production
| |
| /
| /
| /
| /
| /
| /
| /
| /
| /
| /
| /
| /
| /
| /
|/
+
If the hotfix branch doesn't merge cleanly:
+<<<<<<<<<<<<<<<<<<<<<<fix-merge-conflict
| |
| /
| /
| /
| /
| /
| /
| /
| |
| +<<<<hotfix
| | |
| | /
| | /
| | /
| | /
| | /
| |/
| +
development production
| |
| /
| /
| /
| /
| /
| /
| /
| /
| /
| /
| /
| /
| /
| /
|/
+
Note: DO NOT commit to the production branch directly! It might be the fastest way to get things merged, but it WILL cause auditing problems in the future. Be cool, calm, and collected about this, and don't rush it (it's a hotfix, so we want to avoid a hotfix for a botched hotfix).