blob: 333cf6ff91c59fd96b587257ad413268df9a1458 [file] [log] [blame]
Junio C Hamano3bd66e92009-04-18 06:17:561git-difftool(1)
2===============
3
4NAME
5----
6git-difftool - Show changes using common diff tools
7
8SYNOPSIS
9--------
Junio C Hamano15567bc2011-07-23 00:51:5910[verse]
Junio C Hamano2e6ded82010-12-05 06:20:4811'git difftool' [<options>] [<commit> [<commit>]] [--] [<path>...]
Junio C Hamano3bd66e92009-04-18 06:17:5612
13DESCRIPTION
14-----------
Junio C Hamano076ffcc2013-02-06 05:13:2115'git difftool' is a Git command that allows you to compare and edit files
Junio C Hamano3bd66e92009-04-18 06:17:5616between revisions using common diff tools. 'git difftool' is a frontend
Junio C Hamano2e6ded82010-12-05 06:20:4817to 'git diff' and accepts the same options and arguments. See
18linkgit:git-diff[1].
Junio C Hamano3bd66e92009-04-18 06:17:5619
20OPTIONS
21-------
Junio C Hamanobcdb12e2012-05-10 18:45:1522-d::
23--dir-diff::
24Copy the modified files to a temporary location and perform
25a directory diff on them. This mode never prompts before
26launching the diff tool.
27
Junio C Hamano3bd66e92009-04-18 06:17:5628-y::
29--no-prompt::
30Do not prompt before launching a diff tool.
31
32--prompt::
33Prompt before each invocation of the diff tool.
34This is the default behaviour; the option is provided to
35override any configuration settings.
36
37-t <tool>::
38--tool=<tool>::
Junio C Hamanobcdb12e2012-05-10 18:45:1539Use the diff tool specified by <tool>. Valid values include
40emerge, kompare, meld, and vimdiff. Run `git difftool --tool-help`
41for the list of valid <tool> settings.
Junio C Hamano3bd66e92009-04-18 06:17:5642+
Junio C Hamano1aa40d22010-01-21 17:46:4343If a diff tool is not specified, 'git difftool'
Junio C Hamano3bd66e92009-04-18 06:17:5644will use the configuration variable `diff.tool`. If the
Junio C Hamano1aa40d22010-01-21 17:46:4345configuration variable `diff.tool` is not set, 'git difftool'
Junio C Hamano3bd66e92009-04-18 06:17:5646will pick a suitable default.
47+
48You can explicitly provide a full path to the tool by setting the
49configuration variable `difftool.<tool>.path`. For example, you
50can configure the absolute path to kdiff3 by setting
Junio C Hamano1aa40d22010-01-21 17:46:4351`difftool.kdiff3.path`. Otherwise, 'git difftool' assumes the
Junio C Hamano3bd66e92009-04-18 06:17:5652tool is available in PATH.
53+
54Instead of running one of the known diff tools,
Junio C Hamano1aa40d22010-01-21 17:46:4355'git difftool' can be customized to run an alternative program
Junio C Hamano3bd66e92009-04-18 06:17:5656by specifying the command line to invoke in a configuration
57variable `difftool.<tool>.cmd`.
58+
Junio C Hamano1aa40d22010-01-21 17:46:4359When 'git difftool' is invoked with this tool (either through the
Junio C Hamano3bd66e92009-04-18 06:17:5660`-t` or `--tool` option or the `diff.tool` configuration variable)
61the configured command line will be invoked with the following
62variables available: `$LOCAL` is set to the name of the temporary
63file containing the contents of the diff pre-image and `$REMOTE`
64is set to the name of the temporary file containing the contents
Junio C Hamano0d75e872010-12-17 06:57:2665of the diff post-image. `$MERGED` is the name of the file which is
66being compared. `$BASE` is provided for compatibility
67with custom merge tool commands and has the same value as `$MERGED`.
Junio C Hamano3bd66e92009-04-18 06:17:5668
Junio C Hamanobcdb12e2012-05-10 18:45:1569--tool-help::
70Print a list of diff tools that may be used with `--tool`.
71
Junio C Hamano3d1b5a12013-05-17 23:34:0272--[no-]symlinks::
Junio C Hamanoa00504d2012-08-27 21:11:2373'git difftool''s default behavior is create symlinks to the
Junio C Hamano778a3412013-03-28 23:24:3074working tree when run in `--dir-diff` mode and the right-hand
75side of the comparison yields the same content as the file in
76the working tree.
Junio C Hamanoa00504d2012-08-27 21:11:2377+
Junio C Hamano778a3412013-03-28 23:24:3078Specifying `--no-symlinks` instructs 'git difftool' to create copies
79instead. `--no-symlinks` is the default on Windows.
Junio C Hamanoa00504d2012-08-27 21:11:2380
Junio C Hamanoa9701f02010-01-21 00:42:1681-x <command>::
82--extcmd=<command>::
83Specify a custom command for viewing diffs.
84'git-difftool' ignores the configured defaults and runs
85`$command $LOCAL $REMOTE` when this option is specified.
Junio C Hamano0d75e872010-12-17 06:57:2686Additionally, `$BASE` is set in the environment.
Junio C Hamanoa9701f02010-01-21 00:42:1687
88-g::
89--gui::
90When 'git-difftool' is invoked with the `-g` or `--gui` option
91the default diff tool will be read from the configured
92`diff.guitool` variable instead of `diff.tool`.
93
Junio C Hamano2a4bcbc2014-10-29 20:07:3994--[no-]trust-exit-code::
95'git-difftool' invokes a diff tool individually on each file.
96Errors reported by the diff tool are ignored by default.
97Use `--trust-exit-code` to make 'git-difftool' exit when an
98invoked diff tool returns a non-zero exit code.
99+
100'git-difftool' will forward the exit code of the invoked tool when
101'--trust-exit-code' is used.
102
Junio C Hamano3bd66e92009-04-18 06:17:56103See linkgit:git-diff[1] for the full list of supported options.
104
105CONFIG VARIABLES
106----------------
Junio C Hamano1aa40d22010-01-21 17:46:43107'git difftool' falls back to 'git mergetool' config variables when the
Junio C Hamano3bd66e92009-04-18 06:17:56108difftool equivalents have not been defined.
109
110diff.tool::
111The default diff tool to use.
112
Junio C Hamanoa9701f02010-01-21 00:42:16113diff.guitool::
114The default diff tool to use when `--gui` is specified.
115
Junio C Hamano3bd66e92009-04-18 06:17:56116difftool.<tool>.path::
117Override the path for the given tool. This is useful in case
118your tool is not in the PATH.
119
120difftool.<tool>.cmd::
121Specify the command to invoke the specified diff tool.
122+
123See the `--tool=<tool>` option above for more details.
124
125difftool.prompt::
126Prompt before each invocation of the diff tool.
127
Junio C Hamano2a4bcbc2014-10-29 20:07:39128difftool.trustExitCode::
129Exit difftool if the invoked diff tool returns a non-zero exit status.
130+
131See the `--trust-exit-code` option above for more details.
132
Junio C Hamano3bd66e92009-04-18 06:17:56133SEE ALSO
134--------
135linkgit:git-diff[1]::
136 Show changes between commits, commit and working tree, etc
137
138linkgit:git-mergetool[1]::
139Run merge conflict resolution tools to resolve merge conflicts
140
141linkgit:git-config[1]::
142 Get and set repository or global options
143
Junio C Hamano3bd66e92009-04-18 06:17:56144GIT
145---
146Part of the linkgit:git[1] suite