git diff::overriding .gitconfig 外部工具

标签 git git-diff meld

我已经将 git 配置为使用 meld 作为外部 diff 工具:

$ cat ~/.gitconfig | grep -A2 "\[diff\]"
[diff]
        tool = vimdiff
        external = git-meld

... git-meld 是:

$ cat $(which git-meld)
#!/bin/bash
meld $2 $5

但是有时(例如,在非常小的差异的情况下,或者如果我想轻松地从差异文本中复制粘贴某些内容)我只想在 shell 上查看差异并避免 meld' s 产卵延迟。

有没有办法(例如命令行参数)覆盖 .gitconfig 设置并指示 git 只做一个简单的纯文本差异?

最佳答案

对于您的一般问题:几乎所有选项都可以在命令行上使用 -c 覆盖:

-c <name>=<value>

Pass a configuration parameter to the command. The value given will override values from configuration files. The <name> is expected in the same format as listed by git config (subkeys separated by dots).

也就是说,diff.external 是个问题。您可以更改它的值,但无法在命令行上取消设置(我可以看到)。但是,git diff 确实有一个自定义选项来忽略 diff.external 设置:您可以使用

git diff --no-ext-diff

关于git diff::overriding .gitconfig 外部工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19936187/

相关文章:

regex - Meld 和 Perforce 中的空白差异异常(可能是其他)

windows - 无法在 Git Bash 中将 Meld 设置为 diff 工具

macos - 无法通过 MacPorts 安装 Meld

git - 从 git 存储库中删除最旧的提交

git - 修改对共享仓库的 Git 提交

git - 如何编写外部 git diff 来比较添加的行和删除的行(并 stash 匹配项)?

git - 错误 : unmappable character for encoding UTF8 after GIT merge

git - 为什么 git checkout 行为不一致?

我是 : Patch format detection failed

git show commit in beyond compare