Using xxdiff With Git On A Mac

Xxdiff is a great visual diff tool. You can set it up so that whenever you typegit xxdiffin a git branch, you will see all the changes you made since the last commit.

These instructions are meant for setting up xxdiff on a Mac.

First download xxdiff here.

Copy the above into your Mac’s Applications directory.

Create a.xxdiffrcfile in your home directory with the visual settings you would like the xxdiff display to look like. The options can be found in the xxdiff documentation. The contents of my xxdiffrc file are:

Geometry: 1600x900
FontText: "Monaco,12,-1,5,50,0,0,0,0,0"
Show.LineNumbers : true
TabWidth: 2
Accel.Exit: "Esc"
DirDiffRecursive: True

Now that you have xxdiff setup and looking the way you want it, you must integrate it with Git. To do so you will need to have Git installed. Edit your local.gitconfigfile, which is generally found in your home directory.

Add the following to your~/.gitconfigfile:

[diff]
tool = xxdiff
[difftool]
prompt = false
[difftool "xxdiff"]
cmd = /Applications/xxdiff.app/Contents/MacOS/xxdiff \"$LOCAL\" \"$REMOTE\"
path =
[alias]
xxdiff = difftool --dir-diff

Once this is done you should be able to run thegit xxdiffcommand from any git directory and xxdiff will open and show a diff between the previous commit and the changes you have made.

Leave a Reply

Your email address will not be published. Required fields are marked *