Error Encyclopedia

Git Rebase Conflict Error

Fix git rebase conflicts when replaying commits on top of another branch. Learn to resolve conflicts during rebase and when to use rebase vs merge.

What Does This Error Mean?

A git rebase conflict occurs when Git cannot cleanly apply a commit during a rebase operation. Unlike merge conflicts (resolved once), rebase conflicts can occur multiple times — once for each conflicting commit being replayed. Each conflict must be resolved commit by commit.

Common Causes

1

Your branch and the target branch modified the same lines in different ways

2

A file was deleted in one branch but modified in the other

3

Applying commits out of order during interactive rebase (reordering, squashing)

4

Rebasing a long-lived feature branch with many diverging commits

5

Conflicting changes in renamed or moved files

6

Interactive rebase operations like edit, reword, or squash introducing inconsistencies

How to Fix It

Resolve conflicts one commit at a time

After fixing each conflict, stage the changes and continue the rebase.

# Check rebase status
git status

# Fix conflicts in files, then stage them
git add file1.js file2.js

# Continue the rebase
git rebase --continue

# Or skip this commit if no longer needed
git rebase --skip

# Abort rebase if too complex
git rebase --abort

Use patience or recursive strategy

Try different merge strategies for better conflict resolution.

# Use patience algorithm (better for large renames)
git rebase --strategy-option=patience main

# Use recursive with rename detection
git rebase -X rename-threshold=30 main

# Show conflicting diffs in detail
git diff --name-only --diff-filter=U

Split rebase into smaller steps

For long feature branches, rebase incrementally onto intermediate points.

# Instead of rebasing all commits at once:
# 1. First, rebase onto a recent common ancestor
git rebase --onto main~10 feature-start

# 2. Then rebase the rest
git rebase --onto main HEAD~5

# Or use git rerere (reuse recorded resolution)
git config --global rerere.enabled true

Related Errors

Other common errors in this category:

Frequently Asked Questions

Should I use rebase or merge?

Rebase creates a linear history by moving commits on top of the target branch. Merge preserves the full branch structure with a merge commit. Use rebase for private feature branches before merging to main; use merge for public/shared branches.

What is the difference between merge conflict and rebase conflict?

In a merge, you resolve all conflicts at once in a single merge commit. In a rebase, you resolve conflicts per commit — each conflicting commit requires separate resolution. Rebase is more granular but can be more tedious.