git-difftool(1)
===============

NAME
----
git-difftool - compare changes using standard git merge tools

SYNOPSIS
--------
'git difftool' [--tool=<tool>]
               [--commit=<ref> | --start=<ref> --end=<ref>]
               [--no-prompt]
               [--] [<file>]...

DESCRIPTION
-----------
'git-difftool' is a git command that allows you to compare and edit files
between revisions using standard git merge tools.  At its most basic level,
'git-difftool' does what 'git-mergetool' does but its use is for non-merge
situations, such as when preparing commits or comparing changes against
the index.

'git-difftool' shows differences between the work tree and the index by
default but can also show differences between arbitrary commits by using
the --start and --end options.

OPTIONS
-------

-t or --tool=<tool>::
	Use the merge resolution program specified by <tool>.
	Valid merge tools are:
	kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, and opendiff
+
If a merge resolution program is not specified, 'git-difftool'
will use the configuration variable `merge.tool`.  If the
configuration variable `merge.tool` is not set, 'git-difftool'
will pick a suitable default.
+
You can explicitly provide a full path to the tool by setting the
configuration variable `mergetool.<tool>.path`. For example, you
can configure the absolute path to kdiff3 by setting
`mergetool.kdiff3.path`. Otherwise, 'git-difftool' assumes the
tool is available in PATH.
+
Instead of running one of the known merge tool programs,
'git-difftool' can be customized to run an alternative program
by specifying the command line to invoke in a configuration
variable `mergetool.<tool>.cmd`.
+
When 'git-difftool' is invoked with this tool (either through the
`-t` or `--tool` option or the `merge.tool` configuration variable)
the configured command line will be invoked with the following
variables available: `$BASE` is set to the name of a temporary file
containing the contents of the index; `$LOCAL` set to the name of a
temporary file containing the contents of the file as it appears in
the work tree; `$REMOTE` set to the name of a temporary file
containing the contents of the file to be merged, and `$MERGED` set
to the name of the file to which the merge tool should write the
result of the merge resolution.
+
When `--start=<ref>` and `--end=<ref>` are specified
`$LOCAL` contains the contents of the file from the
starting revision and `$REMOTE` contains the contents
of the file in the ending revision.  `$BASE` contains
the contents of the file in the work tree if it exists,
and the starting revision otherwise.
+
If the custom merge tool correctly indicates the success of a
merge resolution with its exit code then the configuration
variable `mergetool.<tool>.trustExitCode` can be set to `true`.
Otherwise, 'git-difftool' will prompt the user to indicate the
success of the resolution after the custom tool has exited.

-c or --commit=<ref>::
	Specifies a commit reference for comparing against.
	'git-difftool' compares against the index by default.

--no-prompt::
	Do not prompt before and after launching a merge tool.

-s or --start=<ref> and -e or --end=<ref>::
	See changes between commits start and end.
	This example shows the latest commit: `--start=HEAD^ --end=HEAD`.

CONFIG VARIABLES
----------------

merge.tool::
	The default merge tool to use.
+
See the `--tool=<tool>` option above for more details.

merge.keepBackup::
	The original, unedited file content can be saved to a file with
	a `.orig` extension.  Defaults to `true` (i.e. keep the backup files).

mergetool.<tool>.path::
	Override the path for the given tool.  This is useful in case
	your tool is not in the PATH.

mergetool.<tool>.cmd::
	Specify the command to invoke the specified merge tool.
+
See the `--tool=<tool>` option above for more details.

mergetool.<tool>.trustExitCode::
	For a custom merge command, specify whether the exit code of
	the merge command can be used to determine whether the merge was
	successful.  If this is not set to true then the merge target file
	timestamp is checked and the merge assumed to have been successful
	if the file has been updated, otherwise the user is prompted to
	indicate the success of the merge.


SEE ALSO
--------
linkcola:git-cola[1]::
	'git-difftool' is part of the 'git-cola' project.

linkgit:git-mergetool[1]::
	'git-difftool' uses many of the same concepts as the core
	'git-mergetool' command.

linkgit:git-config[7]::
	 Get and set repository or global options.

AUTHOR
------
Written by David Aguilar <davvid@gmail.com>.

