[git-merge] 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:

  • /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.

This question is related to git-merge meld

The answer is


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

This worked for me on Windows 8.1 and Windows 10.

git config --global mergetool.meld.path "/c/Program Files (x86)/meld/meld.exe"

After installing it http://meldmerge.org/ I had to tell git where it was:

git config --global merge.tool meld
git config --global diff.tool meld
git config --global mergetool.meld.path “C:\Program Files (x86)\Meld\meld.exe”

And that seems to work. Both merging and diffing with “git difftool” or “git mergetool”

If someone facing issue such as Meld crash after starting (problem indication with python) then you need to set up Meld/lib to your system environment variable as bellow C:\Program Files (x86)\Meld\lib


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\"

For windows add the path for meld is like below:

 git config --global mergetool.meld.path C:\\Meld_run\\Meld.exe

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

It took a few permutations to get meld working on windows for me. This is my current .gitconfig:

[merge]
    conflictstyle = diff3
    tool = meld
[mergetool "meld"]
    cmd = \"C:\\Program Files (x86)\\Meld\\Meld.exe\" --auto-merge \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output \"$MERGED\"

Linux:

[merge]
    conflictstyle = diff3
    tool = meld
[mergetool "meld"]
    cmd = meld --auto-merge $LOCAL $BASE $REMOTE --output=$MERGED --diff $BASE $LOCAL --diff $BASE $REMOTE

I believe adding conflictstyle = diff3 changes the inline text to include BASE contents in the output file before meld gets to it, which might give it a head start. Not sure.

Now, since I already noted Meld supports three-way merging, there is another option. When “diff3” git conflict style is set, Meld prints “(??)” on the line showing the content from BASE. source

A few meld command line features I really like:

  • --auto-merge does a great job at choosing the right thing for you (it's not bulletproof, but I consider the time saved to be worth any risk).

  • You can add extra diff windows in the same command. E.g.:

    --diff $BASE $LOCAL --diff $BASE $REMOTE

    will add two more tabs with the local and incoming patch diffs. These can be quite useful to see separately from the 3 way view to see separate diffs from the base in each branch. I could't get this working on windows though.

  • Some version of meld allow you to label tabs with --label. This was more important before git fixed the names of the files passed to meld to include local/base/remote.

  • The order of --diff can affect the tab order. I had trouble in some older versions that were putting the additional diffs first, when the main 3 way diff is far more frequently used.