Cannot make git diff use diff.external for external diff tool

邮差的信 提交于 2019-12-13 21:09:32

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/22883901/cannot-make-git-diff-use-diff-external-for-external-diff-tool

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!