I believe the solution is git diff -m
. I found the doc on this very confusing, so here's my summary. Given the command git diff -m child parent1 parent2 ....
you'll see a multi-parent diff that shows how to get from each parent to the child. parent1
represented in the first column of [ +-]
and so on. The major roadblock here is that the child in your question has no referenceable name. git write-tree
comes to the rescue here; it creates a name for the currently-staged files, and prints it out.
Note that write-tree will fail if there are any unmerged files, which is probably what you want, but you'll need to make sure your system does something intelligible in that case.
$ CURRENTLY_ADDED=`git write-tree`
$ git diff -m $CURRENTLY_ADDED HEAD MERGE_HEAD
diff --cc README
index 2ef4a65,8e2e466..be3d46e
--- a/README
+++ b/README
@@@ -1,10 -1,5 +1,10 @@@
-deleted only in <theirs>
+added only in <theirs>
- deleted only in <ours>
+ added only in <ours>
--deleted during merge
++added during merge