A cherry-pick hits conflicts and you are unsure about it.
BeginnerScenarioRebase, Cherry-pick and History Rewriting
Answer
Situation read → The target branch has diverged from where the commit was made.
What I'd do →
git statusshows the conflicted files; look at what the commit intended withgit show <sha>.- Resolve,
git add, thengit cherry-pick --continue. - If it is too different:
git cherry-pick --abortand ask whether a manual port is better.
Why → Cherry-pick is a three-way merge using the commit's parent as the base.
Interview tip → Heavy conflicts usually mean the fix needs a manual backport, not a mechanical one.
More on Rebase, Cherry-pick and History Rewriting
Your PR branch has ten commits like "wip", "fix typo", "oops". How do you clean it up before review?BeginnerYou want the database migration commit to come before the code that uses it.BeginnerA critical fix on `main` must go to the `release/4.1` branch only.BeginnerYou must backport a feature made of 6 commits, including one merge commit.IntermediateBranch B was built on top of branch A. A was squash-merged into `main`, and now B shows A's commits again.IntermediateDuring review you get ten small change requests on old commits. How do you apply them cleanly?Intermediate