Interview Prep/Git & GitHub/Branching and Merging Workflows

A hotfix went straight into `release/2.3`. How do you make sure it also reaches `main`?

IntermediateScenarioBranching and Merging Workflows
Answer

Situation read → Fixes made on a release branch must flow forward, or the bug returns in the next release.

What I'd do →

  1. Open a PR from release/2.3 into main (merge forward), or cherry-pick the fix with -x.
  2. Prefer the reverse in future: fix on main first, then backport to the release branch.
  3. Add a CI or checklist rule: no release-branch fix without a linked forward-port PR.
git switch main
git cherry-pick -x <hotfix-sha>

Why → -x records the origin SHA in the message, making backports traceable.

Interview tip → "Fix forward first, backport second" is the policy answer most teams like.

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching and Merging Workflows