Git rerere
Byte-sized agent skills for giving advanced knowledge to AI agents
npx -y skills add narenaryan/agent-skills --skill git-rerereAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use when the same merge conflicts keep recurring across rebases or long-running integration branches — enables automatic replay of previously-recorded resolutions
SKILL.md
1.9 KB, as published. Nobody here has run it
Git Rerere (Reuse Recorded Resolution)
Rerere fingerprints conflict hunks + resolutions. On any later merge/rebase/cherry-pick producing the same conflict, Git auto-applies the stored fix.
Enable
git config --global rerere.enabled true
git config --global rerere.autoupdate true # also stage auto-resolved files
Storage: .git/rr-cache/<hash>/{preimage,postimage}. Local, not pushed.
Commands
git rerere status # files with recorded preimages
git rerere diff # current vs recorded resolution
git rerere remaining # unresolved files
git rerere forget <file> # discard a recorded resolution
git rerere gc # prune old entries
Flow
- First conflict:
Recorded preimage for 'file'. - Resolve + commit:
Recorded resolution for 'file'. - Next time the same conflict appears:
Resolved 'file' using previous resolution.— withautoupdate, already staged.
Canonical Uses
- Long-running topic branch rebased onto main repeatedly.
- Nightly integration branches that merge many topics, reset, re-merge.
- Test-merge-and-reset to pre-record resolutions:
git merge feature && git reset --hard HEAD~ # resolution is recorded; next merge applies it automatically
Sharing
rr-cache isn't pushed. Copy between checkouts:
rsync -a .git/rr-cache/ other-repo/.git/rr-cache/
Pitfalls
- Matches exact conflict content — whitespace/ordering drift breaks the match. Check
git rerere diffbefore trusting auto-resolution. - With
autoupdate=true, a bad past resolution silently re-applies. Spot-check. - Auto-resolved files show no conflict markers; use
git rerere forget <file>to re-surface for manual redo.