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 →
- Change policy: fix on
mainfirst, then backport. - Where a release-only fix is needed, require a linked forward-port PR before the release closes.
- Detect drift:
git cherry -v main release/2.5andgit log --cherry-pick --right-only main...release/2.5. - 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".
More on Branching Strategies and Releases
An eight-person team deploys several times a day. Which branching strategy do you recommend?IntermediateWhen would you choose GitFlow over trunk-based development?IntermediateIn trunk-based development, a feature will take three weeks. How do you merge it daily without exposing it?IntermediateYou are cutting a release. How do you manage the release branch and late fixes?IntermediateShould releases use lightweight or annotated tags?BeginnerA release tag was placed on the wrong commit and has been published. What do you do?Intermediate