Could not apply <hash>... Resolve all conflicts manually, then run git rebase --continue
ID: git/rebase-interactive-conflict
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 2 | active | — | — | — |
Root Cause
Interactive rebase replays commits one by one onto a new base. When a commit conflicts with the new context, git stops and asks you to resolve manually. Unlike a simple merge conflict, you may face multiple rounds of conflicts (one per conflicting commit). The todo file in .git/rebase-merge/ controls which commits are replayed.
genericWorkarounds
-
90% success Resolve conflicts commit by commit with git rebase --continue
For each conflicting commit: 1) Open conflicted files and resolve the markers (<<<< ==== >>>>). 2) Stage resolved files with 'git add <file>'. 3) Run 'git rebase --continue' to proceed to the next commit. Repeat until all commits are replayed. Use 'git diff' and 'git status' to verify resolution at each step.
Sources: https://git-scm.com/docs/git-rebase
-
95% success Abort and retry with a different rebase strategy
Run 'git rebase --abort' to return to the state before rebase started. Then try alternative approaches: 1) Squash locally first with 'git reset --soft' then recommit, 2) Use 'git rebase -i --autosquash' with fixup commits, 3) Rebase fewer commits at a time to isolate conflicts.
Sources: https://git-scm.com/docs/git-rebase
-
80% success Use git rerere to auto-resolve recurring conflicts
Enable with 'git config --global rerere.enabled true'. Git records how you resolve conflicts and auto-applies the same resolution if the same conflict appears again. Particularly useful for long-running feature branches that are rebased repeatedly against main.
Sources: https://git-scm.com/docs/git-rerere
Dead Ends
Common approaches that don't work:
-
Using git merge instead of resolving the rebase conflict
95% fail
You cannot mix merge and rebase operations. Running 'git merge' while a rebase is in progress creates an inconsistent state. You must either resolve the current conflict and 'git rebase --continue', or abort entirely with 'git rebase --abort'.
-
Editing .git/rebase-merge/git-rebase-todo manually after rebase has started
80% fail
The todo file can only be safely edited during the initial editor prompt of git rebase -i. Once rebase has started replaying commits, modifying the todo file directly leads to unpredictable behavior. If you need to change the plan, abort and restart the interactive rebase.
-
Running git rebase --skip without understanding what commit is being skipped
75% fail
--skip permanently drops the current commit from the rebased history. If you skip a commit that contains important changes (not just conflict noise), those changes are lost from the branch. Always check 'git log --oneline REBASE_HEAD' or 'git show REBASE_HEAD' before skipping.