0

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

Honey
  • 24,125
  • 14
  • 123
  • 212

1 Answers1

1
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).

torek
  • 330,127
  • 43
  • 437
  • 552
  • Hah! I just did `git config merge.tool` (without the `--global`) and it returned `vimdiff`.This just helped me better understand the `--global` option. Thanks – Honey Mar 08 '19 at 22:40
  • Right, that would ask Git: *what tool should you use for **this** repository?* Which of course was your override setting. – torek Mar 08 '19 at 22:55