Forgetting a bad rerere resolution Jump to heading
rerere is valuable because it repeats your conflict resolutions exactly. That is also its failure mode. If you resolved a conflict wrongly once — kept the wrong side, dropped a line — rerere will apply that wrong resolution every time the same conflict appears, quietly, in every future rebase and re-merge. People often notice only after the bad resolution has shipped twice. The fix is targeted: tell rerere to forget the resolution for a specific file, resolve it correctly, and let it record the new answer. This page shows how to recognise a reused bad resolution, remove it, and, when necessary, clear the cache entirely, within rerere conflict automation.
When to use this approach Jump to heading
- A file comes out of every rebase with the same wrong content, and you never resolved it consciously this time.
git rerere statuslists a file you expected to resolve by hand.- A conflict resolution was wrong, was fixed in a later commit, and keeps coming back during rebases.
- You trained rerere from history and suspect it learned a bad merge, as warned in training rerere from existing merge history.
Step 1 — Recognise a reused resolution Jump to heading
When rerere applies a recorded resolution, Git prints a line about it. Those lines are easy to miss in a long rebase, so check explicitly whenever a conflicted operation stops or finishes.
Resolved 'src/billing/totals.py' using previous resolution. git rerere status # files where rerere has a preimage for the current conflict
git rerere diff # the resolution rerere applied, as a diff from the conflicted state Step 2 — Forget the resolution for one file Jump to heading
git rerere forget <path> removes the recorded resolution for the conflict currently present in that file. It must be run while the conflict exists — during a merge or rebase that stopped on it.
# During the rebase/merge, with the conflict in progress
git rerere forget src/billing/totals.py
# Restore the conflict markers so you can resolve it properly
git checkout --conflict=zdiff3 -- src/billing/totals.py forget removes the postimage for that conflict and leaves the preimage, so the next time you resolve the file rerere records your new resolution in its place.
# Verification: the file has conflict markers again and rerere no longer resolves it
grep -c '^<<<<<<<' src/billing/totals.py
git rerere status | grep -c totals.py Step 3 — Resolve correctly and let rerere record it Jump to heading
Resolve the file properly, stage it, and continue. rerere records the new resolution at that point.
$EDITOR src/billing/totals.py
git add src/billing/totals.py
git rebase --continue # or git commit for a merge Step 4 — Fix a bad resolution that already landed in history Jump to heading
If a bad resolution is already in a commit, forgetting it stops it recurring but does not fix the commit. Fix the content with a normal commit (or a fixup if the branch is still private), and check whether the same mistake appears anywhere else rerere could have applied it.
# Find commits made after the bad resolution was recorded that touched the file
git log --since="$(stat -c %y "$(git rev-parse --git-common-dir)/rr-cache" | cut -d' ' -f1)" \
--oneline -- src/billing/totals.py Step 5 — Clear the whole cache when you cannot trust it Jump to heading
If many resolutions are suspect — for example, after training on a range that included bad merges — clearing the cache is quicker than forgetting entries one by one. git rerere clear removes only entries for the current, unfinished conflict; to remove everything, delete the directory.
git rerere clear # current operation's records only
rm -rf "$(git rev-parse --git-common-dir)/rr-cache" # every recorded resolution ⚠️ SAFETY WARNING: Deleting
rr-cacheremoves every recorded resolution, including correct ones built up over months, and cannot be undone. Archive it first if there is any chance you will want some of it back:tar czf rr-cache-$(date +%F).tgz -C "$(git rev-parse --git-common-dir)" rr-cache.
Step 6 — Catch bad resolutions before they are recorded Jump to heading
The cheapest bad resolution to fix is one that never gets recorded. Two habits help. Run the tests before committing a conflict resolution, since rerere records the resolution at commit time. And for files where a wrong resolution is costly — schemas, migrations, money-handling code — read the result against the base rather than against one side.
# Before committing a resolution: what does the result change relative to each parent?
git diff HEAD -- src/billing/totals.py # versus ours
git diff MERGE_HEAD -- src/billing/totals.py # versus theirs
make test If either diff contains something neither side intended, the resolution is wrong, and now is the moment to fix it — before rerere makes it permanent.
Validation checklist Jump to heading
Frequently Asked Questions Jump to heading
Can I forget a resolution without being in a conflict? Jump to heading
Not with git rerere forget, which needs the conflict to identify the entry. Outside a conflict, find the entry by its content in rr-cache and delete that directory, as described in inspecting the rerere cache.
Why did rerere apply a resolution to a conflict that looked different? Jump to heading
rerere matches on the conflicted hunk’s content, normalised. Two conflicts with the same conflicting lines, even in different files or contexts, can share a resolution. That is usually helpful and occasionally wrong.
Would rerere.autoUpdate have hidden this from me? Jump to heading
It would have staged the bad resolution automatically, so the operation might not have stopped at all. That is the main argument for leaving autoupdate off, discussed in rerere autoupdate and safe defaults.
Related Jump to heading
- Rerere Conflict Automation — the parent topic.
- Inspecting the rerere Cache — finding entries by content.
- Sharing rerere Resolutions Across a Team — where a bad shared entry spreads further.
- Reading diff3 and zdiff3 Conflict Markers — resolving correctly the second time.