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 scrip
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 ...
This question might be a little old, but I just found something that works for me.
Open GitX app(v.7), select "GitX" menu then "Enable Terminal Usage"
At terminal pipe diff to gitx via:
git diff | gitx
I did this for Araxis merge, but modifying these basic instructions should not be hard for whatever you perferred tool is.
First I created ~/bin/git-diff-driver.sh and added execute permission to the file.
#!/bin/sh
/usr/local/bin/compare -title1:"$1 (repo version)" -title2:"$1 " -max "$2" "$5"
Araxis installs it's command line interface tools in /usr/local/bin The compare tool is their generic tool and the araxis* tools feed through compare.
Once this is set up the following lines need to be added to ~/.gitconfig
[merge]
tool = araxismerge
[mergetool "araxismerge"]
cmd = "/usr/local/bin/compare -3 -merge -wait $LOCAL $BASE $REMOTE $MERGED"
path = /usr/local/bin/
[diff]
external = "/Users/mark/bin/git-diff-driver.sh"
This redirects all 2-way and 3-way diffs through Araxis Merge. It seems like the "path =" shouldn't be necessary, but it works.
Good Luck.
I asked a similar question a while back. That answer may help you. There are a couple of questions in there, but one has to do with opening a diff view in something other than FileMerge.
I'm using this script which I have named git-diffx and put in my path:
#!/bin/bash
result=$(git diff $@)
if [ "$result" ]; then
echo "$result" | gitx
fi
Then instead of git diff ..., you call git diffx ....
I'm sorry this doesn't really answer your question about gitx. I'm not even sure if gitx can function as a generic diff tool. You might like FileMerge, a merge/diff tool included in the Xcode install. There is a script called opendiff that can launch it for you. Simply make a script with the following line in it and point diff.external at it.
opendiff $2 $5