When I type "git diff", I'd like to see a side-by-side diff, like with "diff -y", or like to display the diff in an interactive diff tool like "kdiff3". How can this be done?
Use git difftool
instead of git diff
. You'll never go back.
Here is a link to another stackoverflow that talks about git difftool
: How do I view 'git diff' output with my preferred diff tool/ viewer?
For newer versions of git
, the difftool
command supports many external diff tools out-of-the-box. For example vimdiff
is auto supported and can be opened from the command line by:
cd /path/to/git/repo
git difftool --tool=vimdiff
Other supported external diff tools are listed via git difftool --tool-help
here is an example output:
'git difftool --tool=<tool>' may be set to one of the following:
araxis
kompare
vimdiff
vimdiff2
The following tools are valid, but not currently available:
bc3
codecompare
deltawalker
diffuse
ecmerge
emerge
gvimdiff
gvimdiff2
kdiff3
meld
opendiff
tkdiff
xxdiff