View git diff from individual parents

时间:2015-11-12 11:45:51

标签: git git-merge-conflict

Say, I've been presented with a merge conflict, and I managed to fix it, but haven't marked as resolved (i.e. I haven't done git add conflicted files yet). At this point, I can do git diff and I'll be shown how the resultant file differs from each parent, in a combined diff format.

All good so far. Now I wanted to separately inspect how resultant file differs from individual parent. Sure, for a merge conflict involving 2 parents (cherry-pick, rebase etc.), I can use git diff --ours or git diff --theirs, but how do I extend this to more parents?

In other words, if I get conflict from 3 parents, is it possible to view individual diffs w.r.t each parent?

Also, my discovery of --ours and --theirs was rather serendipitous; I couldn't find their usage documented in a diff context.

1 个答案:

答案 0 :(得分:1)

如果

EventHandlers

没有做你想做的事,我想你必须这样做

git diff :1:foo.txt :3:foo.txt

并使用git ls-files -u 创建一些临时文件并进行比较。

另请参阅:Git compare "base" version with "theirs" version of a conflicted file?