Skip to content

A custom git rerere implementation that allows fuzzy matching on conflict context

Notifications You must be signed in to change notification settings

stainless-api/rerereric

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rerereric

rerereric is inspired by git 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

# 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

About

A custom git rerere implementation that allows fuzzy matching on conflict context

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages