如何在git merge commit中列出冲突的文件(父母双方均更改的文件)? [英] How to list conflicted files (files with changes in both parents) in a git merge commit?

查看:84
本文介绍了如何在git merge commit中列出冲突的文件(父母双方均更改的文件)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

qgit有一个不错的选择,即在合并提交中看到有趣的"文件,其中一个有趣的文件定义为在两个父目录中都有更改的文件.要查看这些文件,相应的命令行是什么?

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 be the corresponding command line to see such files?

推荐答案

git show --name-status SHA1_of_merge

将向您显示提交信息和在两个父级中修改过的文件( MM ).

will show you the commit message and files modified in both parents (MM).

例如对于提交 d907bf8ef32:合并分支的git.git存储库"jc/index-pack" 我们看到:

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

如果您不关心提交消息之类的内容,则git show联机帮助页将您指向用于合并提交的格式: git diff-tree --cc .因此,如果您只想查看提交哈希和有趣的文件",请使用:

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

这篇关于如何在git merge commit中列出冲突的文件(父母双方均更改的文件)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆