git - 无法使 git diff 使用 diff.external 作为外部 diff 工具

标签 git ubuntu diff

我将 git 与默认的 Ubuntu 12.04 软件包一起使用:

git --version git version 1.7.9.5



我找不到任何可以让 git diff 打开外部差异工具的机制,它似乎完全忽略了我使用的任何设置。我终于尝试通过使用来强制它使用我的工具

git -c diff.external=/home/john/bin/git-meld diff --ext-diff



但这也不起作用(仍然调用 diff --cc)

我也尝试过设置 GIT_EXTERNAL_DIFF 以及尝试 git difftool --tool=meld (这也奇怪地调用了 diff -cc)。我完全不知道为什么我的差异工具设置被 git 忽略了。我发现 diff -cc 输出难以理解,因为我使用 GUI diff 工具已经很长时间了。

我应该尝试更新到更新的 git 吗?

谢谢你的帮助!
约翰

我的 git 配置设置如下:

git config -l

user.name=jmicco user.email=parent.bank.app@gmail.com diff.external=/home/john/bin/git-meld diff.tool.external=/home/john/bin/git-meld core.editor=emacs core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true remote.origin.fetch=+refs/heads/:refs/remotes/origin/ remote.origin.fetch=refs/notes/:refs/notes/ remote.origin.url=ssh://jmicco@review.gerrithub.io:29418/jmicco/allowance-app remote.origin.pushurl=ssh://jmicco@review.gerrithub.io:29418/jmicco/allowance-app remote.origin.push=HEAD:refs/for/master branch.master.remote=origin branch.master.merge=master remote.gerrit.url=ssh://jmicco@review.gerrithub.io:29418/jmicco/allowance-app remote.gerrit.fetch=+refs/heads/:refs/remotes/gerrit/ remote.gerrit.fetch=refs/notes/:refs/notes/ remote.gerrit.pushurl=ssh://jmicco@review.gerrithub.io:29418/jmicco/allowance-app remote.gerrit.push=HEAD:refs/for/master gerrit.createchangeid=true

最佳答案

尝试:

GIT_EXTERNAL_DIFF="/bin/echo" git diff

它应该打印如下内容:
foo.c /tmp/T1NuN5_foo.c 240b63429c3267f8141ee0f33be9d12fc46216d3 100755 foo.c 0000000000000000000000000000000000000000 100755

然后你的 git 版本一切正常。
diff.external=/home/john/bin/git-meld是无效设置。 Git 期望外部 diff 程序能够识别 git 特定的参数并产生标准的 diff 输出。梅尔德不会那样做。

我想你需要git difftool -t meld

关于git - 无法使 git diff 使用 diff.external 作为外部 diff 工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22883901/

相关文章:

git - Jenkins + Git Publisher - 如何推回 {GIT_BRANCH}?

windows - git-bash.exe : how to run single command?

Java 在 Ubuntu 14 上安装失败

linux - 删除两个目录之间所有相同的文件

git - 在 Git 中存储然后 rebase

git - 为不包含特定单词的提交过滤 Git 日志

node.js - 如何在 ubuntu 上为 CVE-2014-0224 修补 node.js 服务器?

ubuntu - make 找不到 curses.h

diff - darc 的图形差异

linux - 如何做目录之间的精度比较?