Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you make git diff use gitx --diff on OS X

Tags:

git

macos

diff

Gitx has a great diff viewer, how do I make git automatically pipe git diff whatever into gitx?

I've tried to set git config diff.external to a shell script that looks like this:

git diff "$2" "$5" | gitx

However, that only opens all the individual files up into multiple gitx windows, and it really messes up the files names (changes them all to tmp files with crazy names).

Does anyone have a better solution?

like image 963
BJ Clark Avatar asked Apr 10 '09 06:04

BJ Clark


2 Answers

like sigjuice is saying up there. Only that noobs (like i am now) need to know how to "connect" git to use it. Here is what I did

echo 'opendiff $2 $5' > ~/opendiff-git.sh
chmod a+x ~/opendiff-git.sh
git config --global diff.external ~/opendiff-git.sh 

and now all "git diff whatever" should open FileMerge.app ...

like image 64
Wolfram Kriesing Avatar answered Sep 26 '22 19:09

Wolfram Kriesing


I am not quite sure this is what you want but for us on Macs it sure is handy anyway and somewhat related, you might want to try:

$ git difftool -t opendiff #hash

That opens the diff in the opendiff program which I find very useful. This is much easier than creating a shell script and forcing all your diffs through the new external diff. If you are not on a Mac you can probably change the opendiff into your favorite available diff tool...

like image 29
jonalv Avatar answered Sep 26 '22 19:09

jonalv