-1

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)

nonopolarity
  • 146,324
  • 131
  • 460
  • 740

1 Answers1

1

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.

Vince
  • 1,570
  • 3
  • 27
  • 48
  • actually there are already answers: http://stackoverflow.com/questions/12175867/setting-diffmerge-as-visual-git-difftool-not-working http://stackoverflow.com/questions/9627670/git-merge-compare-tool-setup – Vince Aug 30 '12 at 08:04
  • how is that done for opendiff? Also, `merge.tool` is already set, as you see in the config file: `[merge]` and `tool` under it, meaning it is `merge.tool` – nonopolarity Aug 30 '12 at 09:07
  • ok, click on the first link to another question I provided in a comment. I made a mistake, I meant you need both merge.tool and mergetool.. I copy it here for "opendiff": `[merge] tool = opendiff [mergetool "opendiff"] cmd = \"path/to/opendiff\" --result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\" trustExitCode = true keepBackup = false` – Vince Aug 30 '12 at 09:12
  • ok it seems to work... the code in comment and code in answer now are the same? For one thing, the backslash shouldn't be needed, as it is already in the text file but not for the shell command line. Another thing is that, even though it is for `git diff`, the `[merge]` section actually affects it, it is strange. – nonopolarity Aug 31 '12 at 00:11
  • yes I edited so that the post has the right code. you can edit the post to specify the exact syntax if you want. – Vince Aug 31 '12 at 07:07