I can't make git diff use opendiff
I want to use opendiff as default diff-tool for git diff. This used to work but for some reason stopped working. I'm using a script:
echo opendiff $2 $5 > opendiff-git.sh
which is set in .gitconfig:
开发者_高级运维[diff]
external = ~/opendiff-git.sh
This stopped working for me lately. What is wrong?
Update: When I cloned a new repository everything worked fine! Strange!
I found this question while I was trying to set opendiff as my git diff & merge tool. Weird thing is that when I used the echo opendiff $2 $5 > opendiff-git.sh to create a script the script did not contain the argument place holders $2 $5 I added them in manually and it started working!
This command
echo opendiff $2 $5 > opendiff-git.sh
Resulted in opendiff-git.sh file containing
opendiff
I added the two argument placeholders $2 $5 manually
opendiff $2 $5
Made the shell script executable as suggested by knittl
chmod +x ~/opendiff-git.sh
And it works!
make sure your opendiff-git.sh
file has its executable bits set:
chmod +x ~/opendiff-git.sh
You can now specify a default tool using git config
. To use FileMerge, i.e. opendiff
, run:
git config --global diff.tool opendiff
If you view your ~/.gitconfig
file, you should now see:
[diff]
tool = opendiff
It should now work.
精彩评论