What is a hotfix, and how do you release one safely?
BeginnerConceptBranching, versioning & releases
Answer
In one line: A hotfix is an urgent fix for a serious production problem that can't wait for the normal release; you release it quickly but still through the pipeline, with tests and review, not by editing production by hand.
A safe hotfix process:
- Stabilise first — if possible, roll back or turn off the feature flag to stop the impact immediately. Then fix calmly.
- Branch from what's in production:
- Trunk-based / GitHub Flow: fix on a short branch from
main(if main is deployable). - Release branches / GitFlow: branch
hotfix/1.4.1from the production tagv1.4.0.
- Trunk-based / GitHub Flow: fix on a short branch from
- Make the smallest possible change — only the fix, no extra features or refactors.
- Add a test that reproduces the bug, so it can't come back.
- Fast-track review — still get at least one reviewer, even at 2 a.m.
- Run the pipeline — build, tests and scans. Maybe a shortened path, but never skip it entirely.
- Deploy carefully — canary or staged rollout if possible; watch dashboards closely.
- Merge the fix back into main/develop so the next release doesn't bring the bug back.
- Tag and version — for example
v1.4.1. - Post-mortem — why did the bug reach production, and what will catch it next time?
Why not just fix it directly on the server?
- The next deployment would overwrite the fix.
- No review or test — you might make things worse.
- No record of what changed, which breaks audits and confuses the next person.
Example: checkout fails for customers with a coupon. The team disables the coupon feature flag (impact stops in 1 minute), writes a fix with a test, gets a quick review, deploys v3.2.1 via the pipeline with a canary, and confirms the error rate is normal.
Tip for interviews: stress "mitigate first, fix through the pipeline, merge back, learn".
More on Branching, versioning & releases
What is a branching strategy, and why does it matter?BeginnerWhat is trunk-based development?BeginnerWhat is GitFlow, and when would you use it?BeginnerWhat is semantic versioning?BeginnerWhat is a Git tag, and how are tags used in releases?BeginnerWhat is a pull request, and what makes a good code review?Beginner