Search code examples
windowsbashgituser-interfacemeld

Unable to set Meld as a diff tool in Git Bash


Can someone help me to figure out how can I make Meld work on Git Bash for Windows 10? I have followed some instructions but neither worked for me.

After I typed these commands, nothing happened:

git config --global diff.tool meld
git config --global difftool.meld.path "/c/Program Files(x86)/Meld/Meld.exe"
git config --global difftool.prompt false

After using git difftool command, I get this weird error:

git config option diff.tool set to unknown tool: merge
Resetting to default...

This message is displayed because 'diff.tool' is not configured.
See 'git difftool --tool-help' or 'git help config' for more details.
'git difftool' will now attempt to use one of the following tools:
opendiff kdiff3 tkdiff xxdiff meld kompare gvimdiff diffuse diffmerge ecmerge p4merge araxis bc codecompare emerge vimdiff
2 files to edit.

I also tried;

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

My config file:

[user]
    name = user
    email = email@sample.com

[merge]
    tool = meld

[mergetool "meld"]
    cmd = meld --auto-merge \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output \"$MERGED\" --label \"MERGE (REMOTE BASE MY)\"
    trustExitCode = false

[mergetool]
    prompt = false
    keepBackup = false

[diff]
    guitool = meld

    tool = meld
[difftool "meld"]
    cmd = meld \"$LOCAL\" \"$REMOTE\" --label \"DIFF (ORIGINAL MY)\"
    path = C:/Program Files(x86)/Meld/Meld.exe
[difftool]
    prompt = false

Solution

  • Your path is not well written, and there is a missing space character.

    And you should define cmd instead of path.

    Eventually, this should work for you:

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

    Edit:

    If you want Git guidelines of valid tools, you can check it with:

    git difftool --tool-help
    

    Anyway, after our exchanges, you decided to use P4merge; This is a consequent update of my answer.

    This is the way to setup it:

    git config --global merge.tool p4merge
    git config --global mergetool.p4merge.cmd "\"C:/Program Files (x86)/Perforce/p4merge.exe\" \"\$LOCAL\" \"\$REMOTE\""
    git config --global diff.tool p4merge
    git config --global difftool.p4merge.cmd "\"C:/Program Files (x86)/Perforce/p4merge.exe\" \"\$LOCAL\" \"\$REMOTE\""