233

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?

Bill
  • 41,409
  • 24
  • 117
  • 209
Alex Krauss
  • 8,448
  • 4
  • 24
  • 30

1 Answers1

429

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.

Alex Krauss
  • 8,448
  • 4
  • 24
  • 30
  • 6
    +1; this is the actual solution :) `git reset` won’t touch the file. – poke Jan 19 '13 at 00:22
  • 6
    Didn't work for me, file is still marked with `both modified` (in conflict state) – Gaui Apr 25 '16 at 20:18
  • 1
    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 '16 at 20:26
  • Worked perfectly after I accepted the version from the wrong side. – izilotti Oct 07 '16 at 19:24
  • 43
    "file is still marked with `both modified`". That's exactly the intended result of the question. – Kevin Smyth May 05 '17 at 14:16
  • 9
    `-m` as in `--merge` – kontur Dec 16 '19 at 09:38