xcodegitmergetoolopendiff

How can I successfully change my default mergetool utility to opendiff


I initially did the commands mentioned in How to resolve merge conflicts in Git

I did:

git config merge.tool vimdiff
git config merge.conflictstyle diff3
git config mergetool.prompt false

Then I did the commands mentioned How to use opendiff as default mergetool

I did both:

$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
git config --global merge.tool opendiff

I also checked it with:

$ git config --global merge.tool

and terminal says it's opendiff

However when I do git mergetool it reverts back to using vimdiff.

If I try the 2nd solution in the linked answer ie do:

$ git mergetool -t opendiff

Then it works for once.

So how I can permanently change it to opendiff


Solution

  • git config merge.tool vimdiff
    

    This configures Git to use vimdiff for this repository only.

    git config --global merge.tool opendiff
    

    This configures Git to use opendiff for all repositories that don't have a more-specific configuration, i.e., all repositories except the one you configured earlier.

    git config --global merge.tool
    

    This asks Git: What tool would you use if I weren't in this repository, or any other repository that has an override set?

    To make Git use the default, remove the local override:

    git config --unset merge.tool
    

    (note: no --global).