git-mergemeld

How to set Meld as git mergetool


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:

result is the same.

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

python meld

the tool runs.


Solution

  • 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 cask install meld
    git config --global merge.tool meld
    git config --global  diff.guitool meld