https://github.com/stainless-api/rerereric
A custom git rerere implementation that allows fuzzy matching on conflict context
https://github.com/stainless-api/rerereric
Last synced: 10 months ago
JSON representation
A custom git rerere implementation that allows fuzzy matching on conflict context
- Host: GitHub
- URL: https://github.com/stainless-api/rerereric
- Owner: stainless-api
- Created: 2025-03-24T21:47:08.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-08-08T20:55:01.000Z (11 months ago)
- Last Synced: 2025-08-10T00:36:56.170Z (11 months ago)
- Language: Python
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rerereric
rerereric is inspired by [git rerere](https://git-scm.com/book/en/v2/Git-Tools-Rerere). It is a way to cache resolutions to merge conflicts and re-apply those resolutions if they occur again. Unlike `git rerere` it allows fuzzy matching of the context lines surrounding the merge conflicts.
In particular, for two merge conflict to be considered the same:
- They do not need to have occurred in the same file
- They do not need to have occurred on the same line numbers
- The surrounding context does not need to match exactly; instead, you can use the --context and --similarity arguments to specify how many lines of context to look at and how similar it needs to be (as a fraction, relative to the output of difflib)
If a merge conflict has multiple matches in the cache, we prioritize by:
- Looking first at matches with the same filename
- If there are still multiple, looking at how similar the context is
- If there are still multiple, looking at how close the line numbers are
## Installation
```sh
# install from PyPI
pip install https://github.com/stainless-api/rerereric
```
## Usage
```
// save the versions of these files that contain the conflict markers (incl number of lines of non-white space context to save before and after the conflict)
rerereric mark_conflicts --context=3 file1.ts file2.ts
// [resolve conflicts in these files]
// save the resolutions you applied to a cache (looks at the same files specified in the previous step)
rerereric save_resolutions --context=2
// [conflict later re-emerges, possibly in files with different names]
// read resolutions from the cache and apply them if they match (using different files is ok)
rerereric reapply_resolutions file1.ts file3.ts --context=2 --similarity=0.9
```