How to set Meld as git mergetool

Git MergeMeld

Git Merge Problem Overview


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.

Git Merge Solutions


Solution 1 - Git Merge

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

Solution 2 - Git Merge

This worked for me on Windows 8.1 and Windows 10.

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

Solution 3 - Git Merge

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

Solution 4 - Git Merge

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

Solution 5 - Git Merge

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

Solution 6 - Git Merge

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

Solution 7 - Git Merge

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.

Solution 8 - Git Merge

For windows add the path for meld is like below:

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

Solution 9 - Git Merge

Adding below lines in my .gitconfig file in C:\Users\username, solved my issue for 3.20.3 in Windows 10.

[user]
	name = doe
	email = [email protected]
[core]
longpaths = true
[diff]
    tool = meld
[difftool "meld"]
	path=C:/Program Files/Meld/Meld.exe
[difftool]
	prompt = false
[merge]
    tool = meld
[mergetool "meld"]
	path=C:/Program Files/Meld/Meld.exe
[mergetool]
	prompt = false
	KeepBackup = false 

Solution 10 - Git Merge

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPaulView Question on Stackoverflow
Solution 1 - Git MergeVonCView Answer on Stackoverflow
Solution 2 - Git MergeoldwizardView Answer on Stackoverflow
Solution 3 - Git MergeTomasz MajView Answer on Stackoverflow
Solution 4 - Git MergedbnView Answer on Stackoverflow
Solution 5 - Git Mergec.j.mcdonnView Answer on Stackoverflow
Solution 6 - Git MergeYohanimView Answer on Stackoverflow
Solution 7 - Git MergejozxyqkView Answer on Stackoverflow
Solution 8 - Git MergeSekhar TView Answer on Stackoverflow
Solution 9 - Git MergeSameera De SilvaView Answer on Stackoverflow
Solution 10 - Git MergeBhavesh GuptaView Answer on Stackoverflow