Skip to content

Instantly share code, notes, and snippets.

@gwarnes-mdsol gwarnes-mdsol/gdiff forked from miner/gdiff
Last active Mar 25, 2017

What would you like to do?
Use FileMerge as git difftool on Mac OS X
# A git difftool for Mac OS X that uses FileMerge from XCode
# source:
# Setup:
# 1. Copy this file to a known path, e.g. $HOME/bin/gdiff
# 2. Make the file executable:
# chmod +x $HOME/bin/gdiff
# 2. Tell git to use this script as the preferred difftool:
# git config --global diff.tool $HOME/bin/gdiff
# Usage:
# git difftool <git diff arguments>
# find top level of git project
until [ -e "$dir/.git" ]; do
if [ "$dir" == "/" ]; then
echo "Not a git repository" >&2
exit 1;
dir=`dirname "$dir"`
# open fresh FileMerge and wait for terminations to issues with git temp files
open -a FileMerge -n -W --args -left "$1" -right "$2" -merge "$dir" ${@:2}
# references:

This comment has been minimized.

Copy link
Owner Author

gwarnes-mdsol commented Nov 3, 2016

This version adds support for passing additional command line arguments, such as a branch specification:

git difftool -d origin/master

and provides information on how to configure it to be used by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.