260

In a larger git merge with several conflicting files, I incorrectly marked a file as resolved (using git add FILE after some editing)

Now I'd like to undo my conflict resolution attempt and start over resolving that file.

How can I do that?

1

1 Answer 1

482

Found the solution here: http://gitster.livejournal.com/43665.html

git checkout -m FILE

This restores the unresolved state, including all information about parent and merge base, which allows restarting the resolution.

8
  • 6
    +1; this is the actual solution :) git reset won’t touch the file.
    – poke
    Jan 19, 2013 at 0:22
  • 7
    Didn't work for me, file is still marked with both modified (in conflict state)
    – Gaui
    Apr 25, 2016 at 20:18
  • 2
    This really helped me out since it put the file back into it's pre-conflict resolution state. What's interesting is that instead of the two merge points being named "head" and {REVISION}, they're now called "ours" and "theirs".
    – gcode
    Jun 13, 2016 at 20:26
  • 51
    "file is still marked with both modified". That's exactly the intended result of the question. May 5, 2017 at 14:16
  • 14
    -m as in --merge
    – kontur
    Dec 16, 2019 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.