16

When you try to cherry-pick a commit that is already in the current branch, the message

The previous cherry-pick is now empty, possibly due to conflict resolution.

will be shown.

The meaning of that is clear.

However, the message clearly covers some other situation and I don't understand the other case - possibly due to conflict resolution. How can a conflict resolution make a commit empty?

GilZ
  • 6,418
  • 5
  • 30
  • 40
yuranos
  • 8,799
  • 9
  • 56
  • 65
  • Possible duplicate of [git cherry-pick not working](http://stackoverflow.com/questions/7072013/git-cherry-pick-not-working) – Tim Biegeleisen Feb 09 '17 at 14:19
  • I agree it is similar, but my question is quite general and it's not about cherry-pick per se. I want to understand, basically, how can a commit disappear in a process of resolving conflicts as the hint implies - possibly due to conflict resolution. – yuranos Feb 09 '17 at 14:25
  • You might want to reword the question, then, especially the subject line. E.g., perhaps something like: "how would conflict resolution make a commit empty, so that you need to use `--skip` during a Git `rebase` or `am`?" – torek Feb 09 '17 at 18:35

1 Answers1

15

When you cherry pick a commit, git tries to apply a patch. Three outcomes are possible:

  • no change, because the patch was already in ancestors (e.g. when you try to cherry-pick twice)
  • some changes applied
  • conflicts in files

If there are conflicts in files, you can edit them, called "conflict resolution". One way of editing them is to remove all the changes that the cherry-pick would have added. When you do so, you end up with no more changes anywhere, but still the cherry-pick being in progress. That's why this hint says "possibly due to conflict resolution".

tkruse
  • 10,222
  • 7
  • 53
  • 80