Using xxdiff With Git On A Mac

Xxdiff is a great visual diff tool. You can set it up so that whenever you type git xxdiff in 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 .xxdiffrc file 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 .gitconfig file, which is generally found in your home directory.

Add the following to your ~/.gitconfig file:

[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 the git xxdiff command from any git directory and xxdiff will open and show a diff between the previous commit and the changes you have made.