Search code examples
gitmeld

how to set the default external diff in git


I changed my git's external diff to meld. I didn't like it. How can I get back to my original state?

As a side question, I didn't like meld because it refused to open tabs for multiple file comparisons. To view changes in different files, meld would start showing the first diff, and only after closing meld, it would reopen with the second file diff.... is there any setting to fix that? thanks.


Solution

  • You can change the external diff/merge tool globally in your ~/.gitconfig file, or on a per-repository basis in the /repository/path/here/.git/config file.

    For example, if you wish to use kdiff3:

    [diff]
        tool = kdiff3
    [difftool "kdiff3"]
        path = /Applications/kdiff3.app/Contents/MacOS/kdiff3
        trustexitcode = true
    [merge]
        tool = kdiff3
    [mergetool "kdiff3"]
        path = /Applications/kdiff3.app/Contents/MacOS/kdiff3
        keepbackup = true
        trustexitcode = true
    

    If you wish to reset these values back to the system default (i.e: not configured), you can remove the above entries from your ~/.gitconfig file or use the git config command with the unset flag for each of the settings e.g; git config --global --unset diff.tool