[英]What is the difference between `git diff` and `git difftool`?
What is the difference between git diff
and git difftool
? git diff
和git difftool
什么git difftool
?
I see that I can edit the configuration file for git to easily change the external tool used when I invoke git difftool
and it seems that git diff
outputs patches to the command line. 我看到可以编辑git的配置文件,以轻松更改调用git difftool
时使用的外部工具,而且git diff
似乎将修补程序输出到命令行。
Why would I want to use git diff
? 为什么我要使用git diff
?
As you and WKPlus said, git difftool
will use an external tool, while git diff
will show the diff directly in the terminal. 正如您和WKPlus所说, git difftool
将使用外部工具,而git diff
将直接在终端中显示diff。
To answer your last question about when you would want to use git diff
, you can think some of these ones : 要回答有关何时使用git diff
的最后一个问题,可以考虑以下一些问题:
Many other example can be imagined, and maybe you will find some of them yourself using git on daily basis. 可以想象很多其他示例,也许您会每天使用git自己找到其中一些。
git difftool will show you the diff in some tool (for example: vimdiff) and allow you to edit directly. git difftool将在某些工具(例如:vimdiff)中显示差异,并允许您直接进行编辑。
If you only want to check the changes you just did, I think git diff is more convenient. 如果您只想检查刚刚所做的更改,我认为git diff更加方便。
It seems like since use vim
can read a file and then why I want to use cat
? 好像因为使用vim
可以读取文件,然后为什么要使用cat
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.