LinuxCommandLibrary

git-difftool

Compare changes using external visual diff tools

TLDR

Compare using external tool

$ git difftool [file]
copy
Compare with specific tool
$ git difftool -t [vimdiff] [file]
copy
Compare without prompts
$ git difftool -y [file]
copy
Compare staged changes
$ git difftool --staged
copy
Compare commits
$ git difftool [commit1] [commit2]
copy
Directory diff mode
$ git difftool -d [commit]
copy

SYNOPSIS

git difftool [options] [commit] [--] [files...]

DESCRIPTION

git difftool launches external visual diff tools to review changes in Git repositories. Unlike the built-in git diff which displays changes in the terminal, difftool provides a graphical or enhanced viewing experience through specialized applications.
The command supports a wide variety of diff tools including vimdiff, meld, kdiff3, emerge, opendiff, and many others. Directory diff mode (-d) is particularly useful for graphical tools that support comparing entire directory trees simultaneously.

PARAMETERS

-t, --tool tool

Use specific diff tool.
-y, --no-prompt
Don't prompt before launching.
-d, --dir-diff
Directory diff mode.
--staged
Compare staged changes.
--tool-help
List available tools.
-x cmd
Custom command.

CONFIGURATION

~/.gitconfig

Global difftool settings including default tool and tool-specific configurations.
.git/config
Repository-specific difftool configuration overriding global settings.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community