Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
HOWTO: Using FileMerge (opendiff) with Git on OSX

HOWTO: Using FileMerge (opendiff) with Git on OSX

FileMerge (opendiff) can really come in handy when you need to visually compare merging conflicts. Other times it's just a nice visual way to review your days work.

The following method works by creating a simple bash script ( that sets us up with the proper command line arguments for Git to pass off files to FileMerge.

  1. Open the bash script for editing:

     vi ~/bin/
  2. Paste the following code:

     /usr/bin/opendiff "$2" "$5" -merge "$1"
  3. Make the bash script executable:

     chmod +x ~/bin/
  4. Tell Git (globally) to run our bash script when 'git diff' is issued:

     git config --global diff.external ~/bin/

Now head over to your Git-aware project directory and issue a git diff /path/to/modified/ and FileMerge will pop up showing you the differences against it and HEAD.

You can also do things like git diff --cached to review all the changes against HEAD.

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.