Setting up and using Meld as your git difftool and mergetool on a Mac

Sivaram Yadav picture Sivaram Yadav · Apr 10, 2017 · Viewed 17.3k times · Source

How can I install Meld on MacOS, and then set it up as my difftool and mergetool in git?

Answer

vagavan picture vagavan · May 9, 2017
  1. Download the latest .dmg package for Mac from here: Meld for OSX

  2. Set meld as your git difftool/mergetool by editing your ~/.gitconfig and adding the following lines, as mentioned in the above link:

    [diff]
      tool = meld
    [difftool]
      prompt = false
    [difftool "meld"]
      trustExitCode = true
      cmd = open -W -a Meld --args \"$LOCAL\" \"$PWD/$REMOTE\"
    [merge]
      tool = meld
    [mergetool]
      prompt = false
    [mergetool "meld"]
      trustExitCode = true
      cmd = open -W -a Meld --args --auto-merge \"$PWD/$LOCAL\" \"$PWD/$BASE\" \"$PWD/$REMOTE\" --output=\"$PWD/$MERGED\"
    
  3. Use the git difftool command in your repo to compare and edit files between revisions.