如何成功将我的默认 mergetool 实用程序更改为 opendiff

How can I successfully change my default mergetool utility to opendiff

最初做了How to resolve merge conflicts in Git

中提到的命令

我做到了:

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

然后 我做了上面提到的命令 How to use opendiff as default mergetool

我都做了:

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

我也检查过:

$ git config --global merge.tool

终端机说是 opendiff

但是,当我执行 git mergetool 时,它会恢复为使用 vimdiff

如果我尝试链接答案中的第二个解决方案,即:

$ git mergetool -t opendiff

然后一次就成功了。

那么我如何才能将其永久更改为 opendiff

git config merge.tool vimdiff

这会将 Git 配置为仅针对此存储库使用 vimdiff

git config --global merge.tool opendiff

这将 Git 配置为 所有没有更具体配置的存储库 使用 opendiff,即所有存储库 除了 你之前配置的那个

git config --global merge.tool

这会问 Git:如果我不在 这个 存储库或 任何其他存储库中,您会使用什么工具具有覆盖集的存储库?

要使 Git 使用默认值,删除本地覆盖:

git config --unset merge.tool

(注:没有--global)。