This repository stores a shared Git rerere cache under rr-cache/.
Git rerere means "reuse recorded resolution". When enabled, Git records how a
merge conflict was resolved once and can automatically apply the same resolution
when the same conflict appears again. This is useful for repeated kernel, Yocto,
or integration-branch merges that hit known conflicts.
.
|-- README.md
`-- rr-cache/
`-- <conflict-id>/
|-- preimage # conflicted file content seen by Git
|-- postimage # resolved file content recorded by Git
`-- thisimage # current conflict instance, when present
The rr-cache/ directory is intended to be copied or linked into another Git
repository's .git/rr-cache directory.
From the Git repository where you want automatic conflict resolution:
git config rerere.enabled true
git config rerere.autoupdate trueThen install this cache into that repository. Replace /path/to/cache with the
path to this repository.
mkdir -p .git/rr-cache
rsync -a /path/to/cache/rr-cache/ .git/rr-cache/After that, run your merge, rebase, cherry-pick, or automerge workflow normally. When Git recognizes a previously resolved conflict, it will reuse the recorded resolution.
-
Enable
rererein the target repository:git config rerere.enabled true git config rerere.autoupdate true
-
Copy this cache into the target repository:
rsync -a /path/to/cache/rr-cache/ .git/rr-cache/
-
Run the merge or integration command.
-
Check whether Git reused a resolution:
git status git rerere status git rerere diff
-
Review the resolved files before committing.
rererecan save time, but the reused resolution still needs normal code review. -
Commit only after the tree is correct.
When you resolve a new conflict manually in a target repository, Git records the
resolution in that repository's .git/rr-cache. To share it here:
rsync -a /path/to/target/repo/.git/rr-cache/ /path/to/cache/rr-cache/Then commit the updated cache repository:
git status
git add rr-cache
git commit -m "Update rerere cache"Before committing, inspect the changed files and make sure the recorded resolution is correct and does not contain private or generated content that should not be shared.
If you want the target repository to use this cache directly, replace its
.git/rr-cache with a symlink:
rm -rf .git/rr-cache
ln -s /path/to/cache/rr-cache .git/rr-cacheUse this only when you are comfortable with the target repository writing new records directly into this cache checkout.
git rerere status # show paths with recorded conflict resolutions
git rerere diff # show the current conflict resolution diff
git rerere remaining # show conflicts still needing manual resolution
git rerere forget <path> # forget a bad resolution for one path
git rerere gc # prune old rerere records using Git's expiry rules- Always review automatically resolved files before committing.
- Do not assume every reused resolution is valid for a new branch or release.
- If a reused resolution is wrong, fix the file manually and run
git rerere forget <path>before recording the corrected resolution. - Keep this repository focused on
rr-cache/records and documentation. - Avoid committing unrelated build output, logs, or source trees.
This repository is licensed under the GNU General Public License version 2. See
LICENSE.txt for the full license text.
If conflicts are not resolved automatically:
- Confirm
rerereis enabled withgit config rerere.enabled. - Confirm the target repository has records under
.git/rr-cache. - Run
git rerere statusafter the conflict appears. - Check whether the conflict is actually identical to a recorded conflict.
- Resolve it manually once; future identical conflicts can then be reused.