Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 474
Sivaram Yadav Avatar asked Apr 10 '17 08:04

Sivaram Yadav


People also ask

How do I set up and use meld as my Git DiffTool?

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.

How do I use Git git mergetool?

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.

How do I use git diff to merge changes?

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.

What diff tool do you use for meld?

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:


2 Answers

  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.

like image 62
vagavan Avatar answered Sep 29 '22 17:09

vagavan


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

like image 42
Joey Morrow Avatar answered Sep 29 '22 16:09

Joey Morrow