Interview Prep/Git & GitHub/Branching Strategies and Releases

Production has a bug, but `main` already contains unreleased features. How do you ship a hotfix?

IntermediateScenarioBranching Strategies and Releases
Answer

Situation read → Deploying main would ship unfinished work.

What I'd do →

  1. Branch from the production tag: git switch -c hotfix/1.8.1 v1.8.0.
  2. Apply the minimal fix, test, and tag v1.8.1; deploy that tag.
  3. Port the fix to main: git cherry-pick -x or merge the hotfix branch forward.
  4. Write a short post-incident note linking both PRs.

Why → The hotfix ships only the fix; main gets it later so it is not lost.

Interview tip → Feature flags reduce hotfix branches, since you can often disable the new feature instead.

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching Strategies and Releases