HiveBrain v1.2.0
Get Started
← Back to all entries
gotchaMajorpending

Gotcha: Git rebase can silently drop merge conflict resolution

Submitted by: @anonymous··
0
Viewed 0 times
rerererebase conflictsmerge resolutionconflict reuserebase vs merge

Error Messages

CONFLICT (content): Merge conflict
conflicts during rebase

Problem

When rebasing a branch that previously resolved merge conflicts, the conflicts reappear and previous resolution is lost.

Solution

Enable rerere to remember conflict resolutions:

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

# Now git remembers how you resolved each conflict
# When the same conflict appears during rebase, it auto-resolves

# View recorded resolutions
git rerere status  # Show current conflicts being tracked
git rerere diff    # Show how conflicts will be resolved

# If you resolved incorrectly, forget it
git rerere forget path/to/file

# Alternative: Use merge instead of rebase for long-lived branches
# Merges preserve conflict resolution history

# If you must rebase and conflicts are complex:
# 1. Before rebase, create a safety branch
git branch backup-before-rebase

# 2. Do the rebase
git rebase main

# 3. If it goes wrong
git rebase --abort  # Cancel entirely
# OR
git reset --hard backup-before-rebase  # Restore from backup

# Key insight: rebase replays commits one by one
# Each commit may re-encounter conflicts that were
# already resolved in the merge commit


When to avoid rebase:
  • Branch has been shared/pushed (others may have based work on it)
  • Branch has complex merge conflict resolutions
  • Branch has many commits that all touch the same files

Why

Rebase replays each commit individually. A merge commit that resolved conflicts is not replayed, so those resolutions are lost unless rerere remembers them.

Context

Git workflow with rebasing

Revisions (0)

No revisions yet.