Interview Prep/Git & GitHub/Branching Strategies and Releases

Hotfixes on release branches keep diverging from `main`, and bugs reappear in the next release.

AdvancedScenarioBranching Strategies and Releases
Answer

Situation read → Fixes were applied to one line but never forwarded.

What I'd do →

  1. Change policy: fix on main first, then backport.
  2. Where a release-only fix is needed, require a linked forward-port PR before the release closes.
  3. Detect drift: git cherry -v main release/2.5 and git log --cherry-pick --right-only main...release/2.5.
  4. Add a CI job that fails when the release branch has fixes missing from main.

Why → Divergence is invisible until the next release; automated checks surface it early.

Interview tip → Patch-id comparison is how you spot "same fix, different SHA".

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching Strategies and Releases