The hidden gem: Git remembers how you resolved conflicts and auto-applies the same resolution next time.
You resolved a merge conflict between feature-A and main. Now you rebase, and... the same conflict appears again. You resolve it identically. Again. And again every time you rebase.
git rerere = Reuse Recorded Resolution. Git memorizes your conflict resolutions and replays them automatically.
git config --global rerere.enabled trueThat's it. From now on, Git silently records every conflict resolution you make.
- Record: When you resolve a conflict and commit, Git stores the before/after of the conflicted hunks.
- Replay: Next time the same conflict appears (same conflicting lines), Git auto-resolves it.
- You verify: Git applies the resolution but doesn't auto-commit — you review and confirm.
- Long-lived feature branches that you rebase onto main regularly.
- Topic branch workflows where you merge/rebase often.
- "Redo" merges — undo a merge, rework, re-merge without re-resolving.
- Maintaining multiple release branches with shared cherry-picks.
# Enable rerere
git config --global rerere.enabled true
# See current recorded resolutions
git rerere status
# See the diff of what rerere would apply
git rerere diff
# Forget a specific resolution (if it was wrong)
git rerere forget <path>
# Clear all recorded resolutions
git rerere clear# First time: merge with conflict
git merge feature-x
# ... resolve conflicts manually ...
git add .
git commit
# rerere silently records the resolution
# Later: undo and redo the merge
git reset --hard HEAD~1
git merge feature-x
# rerere auto-applies your previous resolution!
# Just verify and commit- Always enable rerere globally. There's no downside.
- If a recorded resolution was wrong, use
git rerere forget <file>to clear it. - Rerere data lives in
.git/rr-cache/— it's local only. - Combine with interactive rebase: rerere handles repeated conflicts during rebase.
bash episodes/demos/04-rerere-demo.sh