Search code examples
gitopendiff

What is a certain way to make Git diff and merge use opendiff?


I am using the github advice to make it work: https://gist.github.com/329690

and right now my global config file contains:

[merge]
        tool = opendiff
        external = /Users/mike/bin/git-diff-cmd.sh

[diff]
        tool = opendiff
        external = /Users/mike/bin/git-diff-cmd.sh

However, when I use gif diff, the output still comes out as text output, and so is any merge conflict when using git merge <branch>. Is there a sure way to make them use opendiff? (when using git diff and git merge and preferably not by other commands)


Solution

  • EDIT: full change

    Not only you need merge.tool as you already set, you also need mergetool.<tool>. In the following you see the code you need (the options --merge and --result depends on opendiff):

    [merge]
        tool = opendiff
    [mergetool "opendiff"]
        cmd = \"/Users/mike/bin/git-diff-cmd.sh\" --merge --result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
        trustExitCode = true
        keepBackup = false
    

    See this Reference and search for "mergetool"

    EDIT: according to the author's comment (sorry I can't spell your name) the [merge] tag is mandatory even for diff.