← all lessons

foundation · 2026-08-21 · automationconflictsgitmergerebase

git rerere

The idea

rerere = "reuse recorded resolution". When you resolve a merge conflict, git can remember how you did it. The next time the same conflict shows up, git replays your resolution automatically instead of making you fix it by hand again. It's off by default; turn it on with git config --global rerere.enabled true. It changes nothing about the merge itself — it only saves you from re-solving conflicts you've already solved once.

How it shows up

On a long-lived branch that keeps re-merging the same divergence (like a sync branch that hits the same file conflict every round), you'll see git say it resolved the file for you:

$ git merge origin/develop
Auto-merging client-mu-plugins/plugin-loader.php
Resolved 'client-mu-plugins/plugin-loader.php' using previous resolution.

You still have to git add the file and finish the merge — rerere fills in the working tree, it doesn't commit. Check its memory with git rerere status / git rerere diff.

Read more

Exercises

  1. Turn it on and prove it fires — enable rerere.enabled, create a repo with two branches that edit the same line, merge (resolve the conflict), then git reset --hard the merge and merge again. Done when: the second merge prints "Resolved ... using previous resolution".
  2. Inspect the memory — during a conflicted merge, run git rerere status and git rerere diff. Done when: you can name which file rerere is tracking and see the recorded fix.

My notes