无法让git diff使用diff.external作为外部diff工具 [英] Cannot make git diff use diff.external for external diff tool

查看:838
本文介绍了无法让git diff使用diff.external作为外部diff工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b


git --version
git版本1.7.9.5


我无法找到任何可以让git diff打开外部diff工具的机制,它似乎完全忽略了我使用的任何设置。我终于试图强制它使用我的工具,使用


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

但这两个都不起作用(仍然在调用diff --cc)



我也尝试设置GIT_EXTERNAL_DIFF以及尝试git diftool --tool = meld(这也奇怪地调用diff -cc)。我完全难以理解为什么我的diff工具设置被git忽略。我发现diff -cc输出不可思议,因为我一直在使用GUI diff工具。



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



感谢您的帮助!
John



我的git配置设置如下:


git config -l <​​/ p>

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
分支。 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.f etch = 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


解决方案

Try:

  GIT_EXTERNAL_DIFF =/ bin / echogit diff 

它应该打印如下内容:

  foo.c /tmp/T1NuN5_foo.c 240b63429c3267f8141ee0f33be9d12fc46216d3 100755 foo.c 0000000000000000000000000000000000000000 100755 

然后,您的git版本一切正常。



diff.external = / home / john / bin / git-meld 是无效设置。 Git期望外部差异程序识别特定于git的参数并生成标准差异输出。 Meld不会这样做。



我认为您需要 git difftool -t meld


I am using git with the default Ubuntu 12.04 packages:

git --version git version 1.7.9.5

I cannot find any mechanism that works to get git diff to open the external diff tool it seems to completely ignore any setting that I use. I finally tried to force it to use my tool by using

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

but that did not work either (still invoking diff --cc)

I have also tried setting GIT_EXTERNAL_DIFF as well as trying git diftool --tool=meld (which also strangely invokes diff -cc). I am completely stumped as to why my diff tool settings are being ignored by git. I find the diff -cc output inscrutable because I have been using GUI diff tools for so long.

Should I try updating to a newer git?

Thanks for any help! John

My git config settings are below:

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

解决方案

Try:

GIT_EXTERNAL_DIFF="/bin/echo" git diff

It should print something like:

foo.c /tmp/T1NuN5_foo.c 240b63429c3267f8141ee0f33be9d12fc46216d3 100755 foo.c 0000000000000000000000000000000000000000 100755

Then everything is ok with your git version.

diff.external=/home/john/bin/git-meld is an invalid setting. Git expects the external diff program to recognize the git-specific arguments and produce a standard diff output. Meld won't do that.

I think you need git difftool -t meld

这篇关于无法让git diff使用diff.external作为外部diff工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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