Why is git using different diff tools in different repositories?

199 views Asked by At

I am trying to set up opendiff as my graphical git difftool. In other words, I want opendiff to open a graphical window and show my file changes when I type git difftool on the command line. I've added the following configuration to my ~/.gitconfig:

[diff]
    tool = opendiff
[difftool]
    prompt = false
[difftool "opendiff"]
    cmd = opendiff \"$LOCAL\" \"$REMOTE\"

When I run git difftool in most repositories, it opens opendiff as I desire, but in one particular repo, it always just shows me a text diff in the terminal.

I've run git config --list in both repositories and the only differences are those you'd expect - origin and branch names, and such - all the diff settings are identical.

So - what else could be causing git to work differently in these two repositories?

EDIT:

Contents of the badly behaving repo's .git/config, slightly redacted:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = git@<ORIGIN_URL>
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "develop"]
    remote = origin
    merge = refs/heads/develop
[branch "feature/FEATURE1"]
    remote = origin
    merge = refs/heads/FEATURE1
[branch "feature/FEATURE2"]
    remote = origin
    merge = refs/heads/FEATURE2

EDIT2:

This is the diff between git config --list in both repos, slightly redacted:

40c40
< remote.origin.url=git@<GOOD_REPO_URL>
---
> remote.origin.url=git@<BAD_REPO_URL>
42,43c42,47
< branch.master.remote=origin
< branch.master.merge=refs/heads/master
---
> branch.develop.remote=origin
> branch.develop.merge=refs/heads/develop
> branch.feature/FEATURE1.remote=origin
> branch.feature/FEATURE1.merge=refs/heads/feature/FEATURE1
> branch.feature/FEATURE2.remote=origin
> branch.feature/FEATURE2.merge=refs/heads/feature/FEATURE2

EDIT3:

Well, this is embarrassing... I can no longer reproduce the issue! Now it is working in both repos just as I expected. I swear I didn't change anything, guys... Just running from home instead of work. Gremlins?

1

There are 1 answers

3
Romain Valeri On

This difference you see could be the result of different settings in local and global configs.

Try to compare outputs of the following :

git config --global -l

and

git config --local -l

Then, to change the behaviour of the specific repo you described as calling a different tool, I'd try to get into that repo and reset config with --unset, along the lines of

git config --local --unset difftool

or maybe

git config --local --unset diff.tool