🎯 What & whygit rerere (REused REcorded REsolution) records how you resolve a conflict and replays that resolution the next time the same conflict appears. It is a quiet productivity multiplier on long-lived topic branches and repeated rebases.
🧠 Mental modelA key-value cache: key is the pre-image conflict hunk, value is your resolution. On re-encounter, git stages the cached resolution automatically; you only re-verify.
🛠️ Synopsisgit rerere [clear | forget <pathspec> | diff |
remaining | status | gc]🎚️ Switches & optionsFlag What it does rerere.enabled=trueConfig switch; rerere does nothing until you set this. rerere.autoUpdate=trueAuto-stage replayed resolutions instead of just applying them to the worktree. --rerere-autoupdatePer-command override for merge/rebase/cherry-pick.
📦 Subcommandsclear — Wipe all recorded resolutions for the current merge.
forget <path> — Drop the recorded resolution for a specific path; re-record on next conflict.
git rerere forget src/api.pydiff — Show what rerere would apply for the current conflicts.
remaining — List paths that still have unresolved conflicts.
status — Show paths where rerere has recorded data for the current conflict.
gc — Prune old, unused recorded resolutions from .git/rr-cache.
💡 Use casesLong-running feature branch that you rebase onto main weekly; same conflicts recur. Splitting a big merge into smaller test steps, redoing the merge several times. Reapplying a series of cherry-picks across release branches with overlapping context. Recovering from a botched rebase without re-resolving every hunk by hand. 🧪 ExamplesTurn it on globally
git config --global rerere.enabled trueForget a bad recorded resolution
git rerere forget path/to/file.txtSee what rerere is about to do
Garbage-collect stale entries
🎓 RecommendationsEnable rerere globally; the cost is near zero, the upside on rebases is large. Also set rerere.autoUpdate=true so replayed resolutions land in the index without an extra git add. Use git rerere forget <path> the moment you realize a recorded resolution is wrong; otherwise it haunts you. 🪤 Common pitfallsRerere will happily replay a buggy resolution forever; always re-read the diff after auto-apply. Resolutions are local to .git/rr-cache and not shared with the team; teammates each build their own. Subtle context drift can cause rerere to silently not match; don't assume it always kicked in. 📝 QuizHit each option, then Check answers . Score is recorded; Next is always open.
← Previous M22 · git merge-tree Tier index Tier 2 Next → M24 · git show-branch