Reputation: 2782
I am trying to resolve merge conflicts during cherrypick and I realized I accepted the wrong version of 1 of the files. I want to see the conflicts again and choose the other version.
Upvotes: 1
Views: 205
Reputation: 488213
If you have not yet run git commit
or git cherry-pick --continue
, and are doing the resolving in the command line, use git checkout -m
to restore the index to the unmerged state. For instance (this example uses git merge
rather than git cherry-pick
but the process is the same either way):
$ git merge $other
[snip some merge output complaining of conflict, e.g., ending with]
CONFLICT (content): Merge conflict in file
Automatic merge failed; fix conflicts and then commit the result.
$ git status
[snip]
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: file
[snip]
$ vim file
[snip]
$ git add file
$ git status
On branch ...
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
$ git checkout -m file
$ git status
[snip]
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: file
If you have already committed, it's too late: you must re-perform the operation. (Make sure you have git rerere
disabled.)
Upvotes: 4
Reputation: 1369
git reset --hard
to the previous commit and then do the cherry pick again
Upvotes: 0