Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git rerere manual resolution only

Tags:

git

git-rerere

git rerere happily stores my conflict resolutions and automagically applies them when the same conflicts appear again.

However, sometimes, I encounter a merge conflict with a different context that I don't want auto merged.

Is there a way to make git rerere remember conflict resolutions, but require an explicit call to git rerere to apply them?

To be clear, I'm not looking to git rerere clear or git rerere forget, but rather, simply, not automatically resolve merge conflicts unless explicitly directed (bonus if it can show me the proposed resolution before applying!)

like image 492
arcyqwerty Avatar asked Oct 31 '22 08:10

arcyqwerty


1 Answers

I don't know of a way to not apply rerere for a particular hunk.
You can indeed forget rerere resolution for a file (as discussed here), but not for just a hunk.

You would have to mess directly with .git/rr-cache, as mentioned in this patch:

We record a previously seen conflict and its resolution in a subdirectory of $GIT_DIR/rr-cache, and the name of the subdirectory is computed by hashing the "shape" of the conflicted hunk.
When a similar-looking conflict is encountered later in the working tree, "git rerere" tries to replay the recorded resolution by running a three-way merge to apply the change to go from the previous conflict to the previous resolution to the current conflicted state.

like image 184
VonC Avatar answered Nov 15 '22 07:11

VonC