How do you handle a hotfix when main already contains unreleased features?
BeginnerScenarioDeployments and releases
Answer
Situation read → You need to ship one fix without shipping everything else that's on main.
What I'd do →
- With trunk-based development and flags: unfinished features are off, so just merge the fix to main and deploy normally.
- Without flags: branch from the production tag, cherry-pick the fix, build and deploy that.
git checkout -b hotfix/1.42.1 v1.42.0
git cherry-pick <fix-sha>
git tag v1.42.1 && git push origin hotfix/1.42.1 --tags
- Make sure the fix also lands on main so the next release doesn't regress.
- The hotfix still goes through CI tests and the pipeline; "hotfix" doesn't mean "skip checks".
Why → Cherry-picking from the release tag ships exactly one change on top of known-good code.
Interview tip → Mention merging the fix back to main; forgetting this causes the bug to return.
More on Deployments and releases
A deploy went out and p99 latency doubled. Walk me through it.IntermediateYou deployed a new version and half the pods are in CrashLoopBackOff. What do you do?BeginnerA release passed every test in staging but broke in production. How do you investigate?IntermediateHow would you design a zero-downtime deployment for a stateless API on Kubernetes?BeginnerEvery deploy causes a short spike of 502 errors from the ALB. Why, and how do you fix it?IntermediateHow would you set up a canary release, and what decides whether it gets promoted?Intermediate