简体   繁体   English

'git difftool'仅修改文件

[英]'git difftool' with only modified files

I have many new files as well as some modified files that I added to my branch, and when I do git difftool master it diffs all modified files as well as opening up for all new files. 我有很多新文件以及添加到分支中的一些修改文件,当我执行git difftool master它会git difftool master所有修改过的文件以及为所有新文件打开文件。 I see things like 我看到类似的东西

Launching WinMergeU.exe: /dev/null src/example1.cpp 启动WinMergeU.exe:/ dev / null src / example1.cpp

It is rather annoying since it is somewhat pointless to looking at a diff of new files. 这很烦人,因为查看新文件的差异是毫无意义的。

Is there a way to only have Git diff the modified files and ignore new files? 有没有办法让Git diff修改后的文件而忽略新文件?

我刚刚测试了这个答案 ,它与difftool似乎同样有效。

git difftool --diff-filter=M

Just adding to the answer of Merlin2011 :) 只是增加了Merlin2011的答案 :)

You are looking for --diff-filter=M to show only files M odified between the two branches. 您正在寻找--diff-filter=M ,只显示文件M的两个分支之间odified。

From man git-diff 来自man git-diff

--diff-filter=[ACDMRTUXB*] --diff-filter = [ACDMRTUXB *]

Select only files that are 仅选择以下文件

A Added 一个补充

C Copied C复制

D Deleted D已删除

M Modified M修改

R Renamed R更名

T have their type (mode) changed T改变其类型(模式)

U Unmerged U未合并

X Unknown X未知

B have had their pairing Broken B配对失败

* All-or-none *全无

Any combination of the filter characters may be used. 可以使用过滤器字符的任何组合。

When * (all-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; * (全或全)添加到组合中时,如果在比较中有任何文件与其他条件匹配,则选择所有路径; if there is no file that matches other criteria, nothing is selected. 如果没有符合其他条件的文件,则不会选择任何内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM