Git 2.14.5
[git.git] / Documentation / git-difftool.txt
blob96c26e6aa82c98da1652023f0d04b4b63c8a4944
1 git-difftool(1)
2 ===============
4 NAME
5 ----
6 git-difftool - Show changes using common diff tools
8 SYNOPSIS
9 --------
10 [verse]
11 'git difftool' [<options>] [<commit> [<commit>]] [--] [<path>...]
13 DESCRIPTION
14 -----------
15 'git difftool' is a Git command that allows you to compare and edit files
16 between revisions using common diff tools.  'git difftool' is a frontend
17 to 'git diff' and accepts the same options and arguments. See
18 linkgit:git-diff[1].
20 OPTIONS
21 -------
22 -d::
23 --dir-diff::
24         Copy the modified files to a temporary location and perform
25         a directory diff on them. This mode never prompts before
26         launching the diff tool.
28 -y::
29 --no-prompt::
30         Do not prompt before launching a diff tool.
32 --prompt::
33         Prompt before each invocation of the diff tool.
34         This is the default behaviour; the option is provided to
35         override any configuration settings.
37 -t <tool>::
38 --tool=<tool>::
39         Use the diff tool specified by <tool>.  Valid values include
40         emerge, kompare, meld, and vimdiff. Run `git difftool --tool-help`
41         for the list of valid <tool> settings.
43 If a diff tool is not specified, 'git difftool'
44 will use the configuration variable `diff.tool`.  If the
45 configuration variable `diff.tool` is not set, 'git difftool'
46 will pick a suitable default.
48 You can explicitly provide a full path to the tool by setting the
49 configuration variable `difftool.<tool>.path`. For example, you
50 can configure the absolute path to kdiff3 by setting
51 `difftool.kdiff3.path`. Otherwise, 'git difftool' assumes the
52 tool is available in PATH.
54 Instead of running one of the known diff tools,
55 'git difftool' can be customized to run an alternative program
56 by specifying the command line to invoke in a configuration
57 variable `difftool.<tool>.cmd`.
59 When 'git difftool' is invoked with this tool (either through the
60 `-t` or `--tool` option or the `diff.tool` configuration variable)
61 the configured command line will be invoked with the following
62 variables available: `$LOCAL` is set to the name of the temporary
63 file containing the contents of the diff pre-image and `$REMOTE`
64 is set to the name of the temporary file containing the contents
65 of the diff post-image.  `$MERGED` is the name of the file which is
66 being compared. `$BASE` is provided for compatibility
67 with custom merge tool commands and has the same value as `$MERGED`.
69 --tool-help::
70         Print a list of diff tools that may be used with `--tool`.
72 --[no-]symlinks::
73         'git difftool''s default behavior is create symlinks to the
74         working tree when run in `--dir-diff` mode and the right-hand
75         side of the comparison yields the same content as the file in
76         the working tree.
78 Specifying `--no-symlinks` instructs 'git difftool' to create copies
79 instead.  `--no-symlinks` is the default on Windows.
81 -x <command>::
82 --extcmd=<command>::
83         Specify a custom command for viewing diffs.
84         'git-difftool' ignores the configured defaults and runs
85         `$command $LOCAL $REMOTE` when this option is specified.
86         Additionally, `$BASE` is set in the environment.
88 -g::
89 --[no-]gui::
90         When 'git-difftool' is invoked with the `-g` or `--gui` option
91         the default diff tool will be read from the configured
92         `diff.guitool` variable instead of `diff.tool`. The `--no-gui`
93         option can be used to override this setting.
95 --[no-]trust-exit-code::
96         'git-difftool' invokes a diff tool individually on each file.
97         Errors reported by the diff tool are ignored by default.
98         Use `--trust-exit-code` to make 'git-difftool' exit when an
99         invoked diff tool returns a non-zero exit code.
101 'git-difftool' will forward the exit code of the invoked tool when
102 `--trust-exit-code` is used.
104 See linkgit:git-diff[1] for the full list of supported options.
106 CONFIG VARIABLES
107 ----------------
108 'git difftool' falls back to 'git mergetool' config variables when the
109 difftool equivalents have not been defined.
111 diff.tool::
112         The default diff tool to use.
114 diff.guitool::
115         The default diff tool to use when `--gui` is specified.
117 difftool.<tool>.path::
118         Override the path for the given tool.  This is useful in case
119         your tool is not in the PATH.
121 difftool.<tool>.cmd::
122         Specify the command to invoke the specified diff tool.
124 See the `--tool=<tool>` option above for more details.
126 difftool.prompt::
127         Prompt before each invocation of the diff tool.
129 difftool.trustExitCode::
130         Exit difftool if the invoked diff tool returns a non-zero exit status.
132 See the `--trust-exit-code` option above for more details.
134 SEE ALSO
135 --------
136 linkgit:git-diff[1]::
137          Show changes between commits, commit and working tree, etc
139 linkgit:git-mergetool[1]::
140         Run merge conflict resolution tools to resolve merge conflicts
142 linkgit:git-config[1]::
143          Get and set repository or global options
147 Part of the linkgit:git[1] suite