How to set Meld as git mergetool

2019-01-13 00:23发布

I've set:

git config --global merge.tool meld
git config --global mergetool.meld.path c:/Progra~2/meld/bin/

On "git mergetool" it writes:

Hit return to start merge resolution tool (meld):
The merge tool meld is not available as 'c:/Progra~2/meld/bin/'

I have tried also:

  • /c/Progra~2/meld/bin/
  • "/c/Program files (x86)/meld/bin/"
  • "c:/Program files (x86)/meld/bin/"

result is the same.

when I go to C:/Program files (x86)/meld/bin/ and run

python meld

the tool runs.

6条回答
倾城 Initia
2楼-- · 2019-01-13 00:48

None of the other answers here worked for me, possibly from trying a combination of all of them. I was able to adapt this accepted answer to work with meld. This is now working for me with git 1.9.4, meld 3.14.0, and windows 8.1.

Edit ~/.gitconfig to look like:

[diff]
    tool = meld
    guitool = meld
[mergetool "meld"]
    path = c:/Program Files (x86)/Meld/Meld.exe
[difftool "meld"]
    path = c:/Program Files (x86)/Meld/Meld.exe
查看更多
▲ chillily
3楼-- · 2019-01-13 00:54

I think that mergetool.meld.path should point directly to the meld executable. Thus, the command you want is:

git config --global mergetool.meld.path c:/Progra~2/meld/bin/meld
查看更多
对你真心纯属浪费
4楼-- · 2019-01-13 00:56

meld 3.14.0

[merge]
    tool = meld
[mergetool "meld"]
    path = C:/Program Files (x86)/Meld/Meld.exe
    cmd = \"C:/Program Files (x86)/Meld/Meld.exe\" --diff \"$BASE\" \"$LOCAL\" \"$REMOTE\" --output \"$MERGED\"
查看更多
欢心
5楼-- · 2019-01-13 01:02

For windows add the path for meld is like below:

 git config --global mergetool.meld.path C:\\Meld_run\\Meld.exe
查看更多
Lonely孤独者°
6楼-- · 2019-01-13 01:11

You could use complete unix paths like:

PATH=$PATH:/c/python26
git config --global merge.tool meld
git config --global mergetool.meld.path /c/Program files (x86)/meld/bin/meld

This is what is described in "How to get meld working with git on Windows"

Or you can adopt the wrapper approach described in "Use Meld with Git on Windows"

# set up Meld as the default gui diff tool
$ git config --global  diff.guitool meld

# set the path to Meld
$ git config --global mergetool.meld.path C:/meld-1.6.0/Bin/meld.sh

With a script meld.sh:

#!/bin/env bash
C:/Python27/pythonw.exe C:/meld-1.6.0/bin/meld $@

abergmeier mentions in the comments:

I had to do:

git config --global merge.tool meld
git config --global mergetool.meld.path /c/Program files (x86)/Meld/meld/meldc.exe

Note that meldc.exe was especially created to be invoked on Windows via console. Thus meld.exe will not work properly.


CenterOrbit mentions in the comments for Mac OS to install homebrew, and then:

brew install homebrew/gui/meld
git config --global merge.tool meld
git config --global  diff.guitool meld
查看更多
闹够了就滚
7楼-- · 2019-01-13 01:11

This worked for me on Windows 8.1 and Windows 10.

git config --global mergetool.meld.path "/c/Program Files (x86)/meld/meld.exe"
查看更多
登录 后发表回答