git - 使用 .gitconfig 配置差异工具

标签 git

如何配置 Git 以使用不同的工具来比较 .gitconfig 文件?

我的 .gitconfig 中有这个:

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

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

export GIT_EXTERNAL_DIFF=git-chdiff

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

最佳答案

另一种方法(从命令行):

git config --global diff.tool tkdiff
git config --global merge.tool tkdiff
git config --global --add difftool.prompt false

前两行会将 difftool 和 mergetool 设置为 tkdiff - 根据您的喜好进行更改。第三行禁用烦人的提示,因此无论何时点击 git difftool,它都会自动启动 difftool。

关于git - 使用 .gitconfig 配置差异工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6412516/

相关文章:

git - 我无法提交(您的分支是最新的 'origin/master' )

git - Azure 网站和 Git 提交 ID

git - 是否可以仅通过特定提交添加的修改来 git grep ?

git - 使用 merge 或 rebase 来维护一个部署分支

git - 克隆 pull 请求

git - GitHub 中未经验证的提交

git - Git用户的Perforce?

git - 有没有比 Git 更好的数据库(具有可序列化、不可变、版本化的树)?

Git 仍然添加和跟踪在 .gitignore 中标记的文件夹

git - 如何从 githook 获取参数?