Hotfix
Also called: emergency fix.
A small, urgent fix shipped to the version already in production, without waiting for the next release: you start from that release's branch or tag (not from main, which holds unfinished work), make one fix, test it and deploy it as a patch such as v1.4.1. Because it skips part of the usual path, it still needs its own test and a quick review. The fix must also reach main (merged back, or made on main first and cherry-picked onto the release), or the next release, cut from main, brings the bug back.
Ship a hotfix branches from the live release, makes and tests one fix, deploys it as v1.4.1, then merges the fix into main. Ship a hotfix and forget main skips that last merge, then ships release/1.5 from main.
Chips are commits, newest on the right. H: the fix · M: a merge commit · Meter tick: the 1% error limit
Production: v1.4.0 · Checkout errors: 12% · Fix on release/1.4: no · Fix on main: no
Production runs v1.4.0 from release/1.4, and 12% of checkouts fail. main has moved on with D and E.
Say it in a prompt
Checkout returns 500s on v1.4.0. If redeploying v1.3.2 is safe, roll back first: it stops the errors faster than any code change. Then make a hotfix: create hotfix/1.4.1 from release/1.4 (not from main), commit only the gift card total fix with a test that fails without it, run the full checkout test suite in CI and get one reviewer. Merge it into release/1.4, tag v1.4.1 and deploy; check the checkout 5xx rate is back under 1%. Then merge hotfix/1.4.1 into main, so release/1.5 keeps the fix. Vague vs precise prompt
Vague prompt
fix the checkout bug in production quickly Typical resultFixes the bug on main and deploys main, which also ships two weeks of unfinished features nobody tested for this release. Or it fixes the release branch only, never brings the fix to main, and the next release breaks checkout again.
Precise prompt
Hotfix: branch hotfix/1.4.1 from release/1.4, commit only the gift card fix with a test that fails without it, run the checkout suite and get one review, merge into release/1.4, tag v1.4.1 and deploy, then merge hotfix/1.4.1 into main. Typical resultProduction gets only the fix, checkout errors drop within minutes of the deploy, and main has the fix too, so release/1.5 keeps it. The new test guards the fix, since a hotfix skips part of the usual release testing.
Seen on
- Atlassian Git tutorials, Gitflow workflow: Hotfix branches are used to quickly patch production releases. In Gitflow they start from main (the production line there) and, when done, are merged into both main and develop, the line the next release comes from.
- Pro Git book, Basic Branching and Merging: Its example makes a hotfix branch for an urgent production bug, commits the fix, merges it and deploys it, while unfinished work on another branch stays out until it is merged in later.
- Google SRE book, Release Engineering: Describes the other common order: bug fixes go to the mainline first and are then cherry-picked into the release branch, so the team knows exactly what each release contains.
You might describe it as
- patch what's live without waiting for the next release
- branch from the release that's in production
- ship an urgent fix and merge it back into main
Not to be confused with
- Revert
A hotfix is the urgent path that ships one fix to the release that is live, and that fix is often itself a revert of the bad commit made on the release branch; a revert is the git command that undoes one commit by adding its exact opposite, on any branch.