How to list conflicted files (files with changes in both parents) in a git merge commit?
qgit has the nice option of seeing "interesting" files in a merge commit, where an interesting file is defined as a file that has changes in both parents. What would b开发者_如何转开发e the corresponding command line to see such files?
git show --name-status SHA1_of_merge
will show you the commit message and files modified in both parents (MM
).
e.g. for the git.git repository in commit d907bf8ef32: Merge branch 'jc/index-pack' we see:
$ git show --name-status d907bf8ef327cd47433d4a4bb0a1bb4e96b6e340
commit d907bf8ef327cd47433d4a4bb0a1bb4e96b6e340
Merge: 54dbc1f 3de89c9
…
MM builtin/index-pack.c
MM builtin/pack-objects.c
MM cache.h
MM csum-file.c
MM fast-import.c
MM sha1_file.c
if you don't care about commit message and such, the git show manpage points you to the format used for merge commits: git diff-tree --cc
. so, if you only want to see the commit hash and "interesting files" use:
$git diff-tree --cc --name-status d907bf8ef327cd47433d4a4bb0a1bb4e96b6e340
d907bf8ef327cd47433d4a4bb0a1bb4e96b6e340
MM builtin/index-pack.c
MM builtin/pack-objects.c
MM cache.h
MM csum-file.c
MM fast-import.c
MM sha1_file.c
精彩评论