git difftool,与新文件合并 [英] git difftool, winmerge with new files

查看:468
本文介绍了git difftool,与新文件合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到仅使用difftool显示修改后的文件等条目,但是有人找到了还可以显示新文件的方法吗?我仍然想看看有人在提交中添加了什么,即使它是一个新文件而不是修改文件.似乎difftool需要的是创建一个空的"dummy"文件,以便像winmerge这样的工具需要"diff".

I've seen the entries on only showing modified files etc. with difftool but has anyone found a way yet to also show the new files? I still want to see what someone added as part of the commit, even though it's a new file and not a modification. Seems like what difftool needs is to create an empty 'dummy' file so that tools like winmerge have something to 'diff' against.

推荐答案

我也正在寻找您的问题的答案,但在出现这种情况之前,我会提供一些解决方法.

I too seek the answer to your problem, but I offer some workarounds until that happens.

您也许可以尝试使用 --dir-diff 选项,该选项可以正常工作,但是我宁愿在一个单独的窗口中打开每个更改,也不必遍历目录直到找到不同或新的目录文件.

You may be able to try the --dir-diff option, which works alright, but I prefer each change opening in a separate window than having to trawl through directories until I find a difference or a new file.

git difftool --dir-diff

我一直在做的另一种选择是将 winmerge用于修改的文件,将 kdiff用于新的文件.

Another option I've been doing is to use winmerge for modified files and kdiff for new files.

git difftool -t winmerge --diff-filter=M

git difftool -t kdiff3 --diff-filter=A

请注意,以上内容假设您已在.gitconfig中相应地设置了不同的difftool选项.

Note that the above assumes you've setup the different difftool options in your .gitconfig accordingly.

不太好,但也不是不好的解决方法.差异过滤器选项列表在文档中,StackOverflow上还有另一篇文章关于如何按更改类型过滤git diff .

Not exactly great, but also not a bad workaround. A list of diff filter options is in the documentation, there's also another post here on StackOverflow regarding how to filter git diff by type of change.

实际上我也只是将这些作为别名添加到了.gitconfig中,以便可以相应地键入git dtmgit dta.

I've also actually just added these as aliases in the .gitconfig so that I can just type git dtm and git dta accordingly.

这篇关于git difftool,与新文件合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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