How can I install Meld on MacOS, and then set it up as my difftool and mergetool in git?
How do I set up and use Meld as my git difftool? git difftool displays the diff using a GUI diff program (i.e. Meld) instead of displaying the diff output in your terminal. Although you can set the GUI program on the command line using -t <tool> / --tool=<tool> it makes more sense to configure it in your .gitconfig file.
git mergetool allows you to use a GUI merge program (i.e. Meld) to resolve the merge conflicts that have occurred during a merge. Like difftool you can set the GUI program on the command line using -t <tool> / --tool=<tool> but, as before, it makes more sense to configure it in your .gitconfig file.
The git diff command prints changes to stdout, normally to the terminal screen. Set up a visual diff and merge program for use with git difftool and git mergetool. Changes in binary files do not show well in common diff tools and can take a long time for them to compute visual diffs.
This is an answer targeting primarily developers using Windows, as the path syntax of the diff tool differs from other platforms. I use Kdiff3 as the git mergetool, but to set up the git difftool as Meld, I first installed the latest version of Meld from Meldmerge.org then added the following to my global .gitconfig using:
Download the latest .dmg
package for Mac from here: Meld for OSX
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\"
Use the git difftool
command in your repo to compare and edit files between revisions.
From Mac OS High Sierra (10.13.6), Git 2.12.2
Install Meld
brew tap homebrew/cask
brew cask install meld
Set Meld as Git Mergetool
git config --global merge.tool meld
git config --global diff.guitool meld
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With