使用.gitconfig配置diff工具? [英] Configuring diff tool with .gitconfig?

查看:452
本文介绍了使用.gitconfig配置diff工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何配置git以使用不同的工具来与.gitconfig文件进行区分。

$ $ $
$ gb-chdiff #also试过/ bin / git-chdiff

它不起作用,它只是打开常规命令行diff。当我做的时候

  export GIT_EXTERNAL_DIFF = git-chdiff 

然后git diff会打开外部差异工具(所以我知道外部差异工具脚本工作正常)。我的.gitconfig配置中有diff工具吗?

解决方案

Git提供了一系列difftools预配置的开箱即用(kdiff3,kompare,tkdiff,meld,xxdiff,emerge,vimdiff,gvimdiff,ecmerge,diffuse,opendiff,p4merge和araxis),并且还允许您指定自己的。要使用预配置的difftools之一(例如,vimdiff),可以将以下行添加到〜/ .gitconfig 中:

  [diff] 
工具= vimdiff

另一方面,指定您自己的difftool需要更多的工作,请参阅如何用视觉差异程序查看'git diff'输出?


How do I configure git to use a different tool for diffing with the .gitconfig file. I have this in my .gitconfig:

[diff]
    tool = git-chdiff #also tried /bin/git-chdiff

and it does not work, it just open the regular command line diff. When I do

export GIT_EXTERNAL_DIFF=git-chdiff

then git diff will open up the external diffing tool (so I know the external diff tool script works fine). Do I have something wrong with my .gitconfig configuration for the diff tool?

解决方案

Git offers a range of difftools pre-configured "out-of-the-box" (kdiff3, kompare, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, diffuse, opendiff, p4merge and araxis), and also allows you to specify your own. To use one of the pre-configured difftools (for example, "vimdiff"), you add the following lines to your ~/.gitconfig:

[diff]
    tool = vimdiff

Specifying your own difftool, on the other hand, takes a little bit more work, see How do I view 'git diff' output with a visual diff program?

这篇关于使用.gitconfig配置diff工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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