git rerere

Patching & Rewriting

Reuse recorded conflict resolutions


The 'git rerere' feature (reuse recorded resolution) remembers how you resolved a conflict and applies the same resolution automatically the next time the identical conflict appears — when you rebase again, re-merge a branch or redo a merge. Enable it with rerere.enabled; git then records conflicts and resolutions on its own. You still check the result and git add it.

Synopsis

git rerere [clear | forget <path> | diff | status | remaining | gc]
[ ] optional| or<arg> placeholder... repeatable--flag option

Examples

Turn it on

git config --global rerere.enabled true

From now on conflicts and resolutions are remembered.


Conflicts with a record

git rerere status

Files whose conflict is being recorded.


Forget a bad resolution

git rerere forget app.js

Record it again next time.

Workflow Examples

1
git config rerere.enabled true

Once

2
git merge main … resolve … git reset --hard HEAD~1

Practice merges teach rerere

3
git merge main

The real merge reuses your answers

Troubleshooting

A conflict was resolved wrongly

Cause: A bad resolution was recorded

git rerere forget <file>, resolve again, commit

Tips & Pitfalls

Best Practices

  • ✓Turn it on globally if you rebase often.
  • ✓Always review files rerere resolved before git add.

Common Mistakes

  • ✗Recording a wrong resolution and having it reapplied silently — check files after merges and use rerere forget.

FAQ

A:

Not by default: set rerere.autoUpdate true to stage resolved files automatically.