gitgit-diffopendiff

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!


Solution

  • 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!