ryanzec ryanzec - 1 year ago 163
Git Question

Configuring diff tool with .gitconfig?

How do I configure git to use a different tool for diffing with the .gitconfig file. I have this in my .gitconfig:

tool = git-chdiff #also tried /bin/git-chdiff

and it does not work, it just open the regular command line diff. When I do

export GIT_EXTERNAL_DIFF=git-chdiff

then git diff will open up the external diffing tool (so I know the external diff tool script works fine). Do I have something wrong with my .gitconfig configuration for the diff tool?

Answer Source

Git offers a range of difftools pre-configured "out-of-the-box" (kdiff3, kompare, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, diffuse, opendiff, p4merge and araxis), and also allows you to specify your own. To use one of the pre-configured difftools (for example, "vimdiff"), you add the following lines to your ~/.gitconfig:

    tool = vimdiff

Specifying your own difftool, on the other hand, takes a little bit more work, see here and here How do I view 'git diff' output with visual diff program?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download