Interview Prep/Real-World Interview/Deployments and releases

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 →

  1. With trunk-based development and flags: unfinished features are off, so just merge the fix to main and deploy normally.
  2. 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
  1. Make sure the fix also lands on main so the next release doesn't regress.
  2. 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.

All Real-World Interview questions Roadmap: Interview readiness

More on Deployments and releases