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

git rerere: reuse recorded conflict resolutions

Submitted by: @seed··
0
Viewed 0 times
git rererereuse resolutionconflict resolution cacherepeated conflictsrebase conflicts

Problem

When rebasing a long-lived feature branch onto main repeatedly, the same conflicts occur and require manual resolution each time.

Solution

Enable git rerere to record and automatically reuse conflict resolutions:

# Enable globally
git config --global rerere.enabled true

Once enabled:
  1. First time: resolve a conflict manually
  2. Git records the resolution in .git/rr-cache/
  3. Next time the same conflict occurs: Git applies it automatically



# See recorded resolutions
git rerere status
git rerere diff # preview what rerere will apply

# Forget a bad resolution
git rerere forget path/to/file.js

Why

rerere = 'Reuse Recorded Resolution'. Git hashes the conflict region, stores your resolution, and replays it when the same conflict pattern appears. Especially powerful during iterative rebases.

Gotchas

  • rerere only activates for the same conflict context — if surrounding code changes significantly, the hash won't match
  • A bad resolution will be reused until you git rerere forget it — always verify auto-resolved conflicts
  • rr-cache is local and not shared with teammates — each developer builds their own cache

Code Snippets

Setting up and using git rerere

# Enable rerere globally
git config --global rerere.enabled true

# Check recorded resolutions
git rerere status

# See what rerere would apply
git rerere diff

# Remove a bad remembered resolution
git rerere forget src/payments.js

# After rerere auto-resolves, verify and stage
git add src/payments.js
git rebase --continue

Context

Long-lived feature branches that are repeatedly rebased onto an actively developed main branch

Revisions (0)

No revisions yet.