1

I followed this partly cherry-picking a commit with git to cherry-pick changes on only certain files.

after the cherry-pick, some files had conflicts, i.e. the files have sections like :

<<<<<<<<<<<<
>>>>>>>>>>>>

normally with git merge, I use my beloved p4merge to resolve the conflicts, which is very intuitive and error-free.

but with cherry-pick, when i use git mergetool, it says nothing needs to be merged, though the file has <<<<<< in it. so I had to manually edit and resolve the conflicts.

so how could I let git know that the conflict exists?

thanks Yang

Community
  • 1
  • 1
teddy teddy
  • 3,025
  • 6
  • 31
  • 48
  • I cannot repeat your issue. After `git cherry-pick foo` and `git mergetool`, the p4merge can be fired up automatically here. I am following p4merge method in this link: http://www.andymcintosh.com/?p=33. And my git version is 1.7.9.6. – Penghe Geng Aug 24 '12 at 01:06

1 Answers1

0

If git cherry-pick stalls due to a conflict, then firing git mergetool will pick up the conflicts; that it hasn't implies something else has gone wrong, and that Git has somehow decided the conflict is already resolved.

If you run git blame -L '/^<<<</,/^>>>>/' -- {filename}, that will annotate your file between the change markers, showing where those merge markers were introduced. There're two possibilities:

  • The change markers are marked as "Not Committed Yet". In this case, Git has somehow decided the file has been merged already, either due to a failed invocation of git mergetool, or a dubious invocation of git add.

    The only way I know to recover from this is to abort the cherry-pick (using git cherry-pick --abort) and try again, but there may be better alternatives.

  • The change markers are marked with a specific commit. In this case, someone has been being silly with their commits. If you look at the commit given, it should tell you who made the commit and what it was; you may be able to recover by looking at where it came from and re-resolving.

me_and
  • 15,158
  • 7
  • 59
  • 96
  • I am in the same situation as the OP. `git blame` returns "not committed yet". I aborted the cherry-pick and retried and run git blame immediately, no merge attempts. Same result. git help bug?? – piccolbo Aug 28 '14 at 18:49
  • Aborted cherry-pick, did a merge in the opposite direction, which is routine and then tried again the cherry pick. merge tool started, resolved conflict, committed. Not saying that's THE solution, just a data point. – piccolbo Aug 28 '14 at 23:11