6

I'm currently setting up the Meld difftool to work in Babun using the following commands:

git config --global diff.tool meld
git config --global difftool.prompt false
git config --global difftool.meld.path "/cygdrive/c/Program\ Files\ \(x86\)/Meld/Meld.exe"
git config --global difftool.meld.cmd '/cygdrive/c/Program\ Files\ \(x86\)/Meld/Meld.exe $LOCAL $REMOTE'

This works, and Meld opens with the two files when I run

git difftool HEAD HEAD^

However, the second file (from the remote) doesn't open, and I get

There was a problem opening the file "\tmp\xxx_FILENAME.EXTENSION"

However, when I run the difftool from git bash it works. Is there something wrong in my setup?

4

1 回答 1

7

问题是从 Cygwin 访问临时文件。因为 Cygwin 有自己的驱动器,所以我需要使用它cygpath来格式化文件路径。完整的设置如下:

git config --global diff.tool meld
git config --global difftool.prompt false
git config --global difftool.meld.path "c:\Program Files (x86)\Meld\Meld.exe"
git config --global difftool.meld.cmd 'c:/Program\ Files\ \(x86\)/Meld/Meld.exe "$(cygpath -w "$LOCAL")" "$(cygpath -w "$REMOTE")"'
于 2017-02-02T12:13:31.040 回答