6

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!)

arcyqwerty
  • 10,325
  • 4
  • 47
  • 84
  • To do it for a whole merge, just run it with rerere off: `git -c rerere.enabled=false merge $branch`. – jthill Mar 03 '16 at 07:15
  • 1
    Turning it off and on again is an option (and the one I've been using when I've noticed `rerere` doing undesirable things). But that only works for me when I notice that rerere did undesirable things (since the merge conflicts can involve many files and the rerere auto resolution is sometimes buried in the output. It may also be nice to have `rerere` remember my new resolution (as well as the old, offering an option? I don't think this is a feature yet and may not ever be...). – arcyqwerty Mar 03 '16 at 14:41

1 Answers1

3

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250