A rebase stops with "The previous cherry-pick is now empty". What do you do?
IntermediateScenarioRebase, Cherry-pick and History Rewriting
Answer
Situation read → The commit's change is already present upstream (someone applied the same fix), so replaying it yields nothing.
What I'd do →
- If it is truly a duplicate:
git rebase --skip. - To handle this automatically:
git rebase --empty=drop origin/main. - To keep it as an empty marker commit:
git commit --allow-emptythen continue.
Why → Git stops by default so you consciously confirm that nothing is lost.
Interview tip → Verify with git diff HEAD that the upstream content matches your intent before skipping.
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