0

I have a situation where I'd like git cherry-pick to not "quietly return 0 when some of the source commit's diffs are already present in the destination". Yes, it fails if the resulting commit is empty, but I don't see the option to fail if the resulting commit is not-empty-but-not-the-same-diff-as-the-original. I do not see an option to cherry-pick to do this, and a quick look at git merge which I assume provides the underlying functionality for it, also doesn't seem to provide this, though I'm less sure. Is this possible?


Extra notes: yes, I can perform a diff between git show <sourcecommit> and git show <destcommit>. I do do that, in fact. But this can give a false failure if the cherry-pick picked up a change in a renamed file. I'd alternately be interested in a solution to this problem.

Mort
  • 3,379
  • 1
  • 25
  • 40
  • 1
    There is no built in way to do this. There probably should be, but it needs careful thought about interactions with `git rerere`. – torek Feb 05 '22 at 07:11
  • Thanks. Interestingly, a diff of the `git show` *may* work, if you ignore filenames, but only if the renamed file still sorts alphabetically in the same order wrt the other files. – Mort Feb 05 '22 at 20:46
  • (I think I deserve special SO points for asking a git question that even @torek has no answer for. :-) – Mort Feb 05 '22 at 20:47

0 Answers0