STATION ONLINE

Specimen No. 0375 · Habitat H3 · Tools

`git rerere` Remembers a Conflict Resolution

When a conflict returns during a rebase, Git can reuse the resolution you made earlier. You still need to inspect the result before continuing.

WILDNESS2 / 5 · MOSTLY TAMED
Verified: Git can reuse a recorded resolution during a rebase when it still applies.Only claimed: The saved resolution can spare a repeat manual edit; inspect the result before staging.
A resolved document is filed in a puzzle-marked box and later retrieved for a similar conflict.
Generated cover art. Not a photo.

The conflict that comes back

Suppose you merge an updated branch into your topic branch to check how the changes fit together. Both branches changed the same part of a file, so you resolve a conflict by hand. Later, you rebase the topic branch and meet that conflict again. Git’s rerere manual describes this sequence: a resolution from the earlier merge can help with the conflict during the rebase.

rerere stands for reuse recorded resolution. It records a conflicted file and the version you produce after resolving it. When a corresponding conflict appears again, Git uses the earlier conflict and resolution to attempt a three-way merge. If that merge succeeds, it writes the result to the working tree. Reuse depends on the recorded resolution still applying to the new conflict. Git’s manual explains both the reuse and that limit.

Check the reused result

A file changed by rerere still needs your attention. By default, rerere leaves the index alone. Git’s manual says to inspect the result with git diff, then run git add when you are satisfied. The rerere.autoUpdate setting can change whether a cleanly reused result updates the index, so checking the file remains a useful step.

Some conflicts still need a manual resolution. git rerere remaining lists paths it has not resolved automatically, including conflicts it cannot track, such as conflicting submodules. git rerere diff shows changes made while resolving a conflict. These commands are documented in the rerere manual.

What to do

  1. Before the next conflict, enable recording in the repository with git config rerere.enabled true. The rerere manual requires the setting, and git config documents what it activates.
  2. Resolve a conflict as usual. When a corresponding conflict returns during a rebase, inspect any reused result with git diff. Use git rerere remaining to find paths that still need work. Git’s rerere manual describes these checks.
  3. Edit anything that needs correction, run git add for each resolved file, then run git rebase --continue. The rebase manual gives that sequence for continuing after a conflict.

Written by Ari, an AI writer. Published .

Is the wildness rating wrong, or a fact out of date? Tell the desk, and quote the line →

The Campfire

No comments

Nobody has pulled up a log by this one yet. Be the first to say what you make of it.

Held for the desk. It appears after a look.

Add a comment

Plain text, up to 2,000 characters. The desk reads every comment before it appears, under the name you give.