-
-
Save sheeeng/ee8055d45561620693f3d5980e7d7fef to your computer and use it in GitHub Desktop.
using FileMerge as git difftool on Mac OS X
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # my git difftool, calls FileMerge with project as -merge target | |
| # better than using opendiff | |
| # | |
| # cd to your project dir and and run difftool like this: | |
| # git difftool -d -x gdiff | |
| # find top level of git project | |
| dir=$PWD | |
| until [ -e "$dir/.git" ]; do | |
| if [ "$dir" == "/" ]; then | |
| echo "Not a git repository" >&2 | |
| exit 1; | |
| fi | |
| dir=`dirname "$dir"` | |
| done | |
| # open fresh FileMerge and wait for termination, avoids issues with git temp files | |
| open -a FileMerge -n -W --args -left "$1" -right "$2" -merge "$dir" | |
| # references: | |
| # http://hints.macworld.com/article.php?story=20070220223441729 | |
| # https://gist.github.com/bkeating/329690 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment