1GIT-DIFFTOOL(1) Git Manual GIT-DIFFTOOL(1)
2
3
4
6 git-difftool - Show changes using common diff tools
7
9 git difftool [<options>] [<commit> [<commit>]] [--] [<path>...]
10
12 git difftool is a Git command that allows you to compare and edit files
13 between revisions using common diff tools. git difftool is a frontend
14 to git diff and accepts the same options and arguments. See git-
15 diff(1).
16
18 -d, --dir-diff
19 Copy the modified files to a temporary location and perform a
20 directory diff on them. This mode never prompts before launching
21 the diff tool.
22
23 -y, --no-prompt
24 Do not prompt before launching a diff tool.
25
26 --prompt
27 Prompt before each invocation of the diff tool. This is the default
28 behaviour; the option is provided to override any configuration
29 settings.
30
31 --rotate-to=<file>
32 Start showing the diff for the given path, the paths before it will
33 move to the end and output.
34
35 --skip-to=<file>
36 Start showing the diff for the given path, skipping all the paths
37 before it.
38
39 -t <tool>, --tool=<tool>
40 Use the diff tool specified by <tool>. Valid values include emerge,
41 kompare, meld, and vimdiff. Run git difftool --tool-help for the
42 list of valid <tool> settings.
43
44 If a diff tool is not specified, git difftool will use the
45 configuration variable diff.tool. If the configuration variable
46 diff.tool is not set, git difftool will pick a suitable default.
47
48 You can explicitly provide a full path to the tool by setting the
49 configuration variable difftool.<tool>.path. For example, you can
50 configure the absolute path to kdiff3 by setting
51 difftool.kdiff3.path. Otherwise, git difftool assumes the tool is
52 available in PATH.
53
54 Instead of running one of the known diff tools, git difftool can be
55 customized to run an alternative program by specifying the command
56 line to invoke in a configuration variable difftool.<tool>.cmd.
57
58 When git difftool is invoked with this tool (either through the -t
59 or --tool option or the diff.tool configuration variable) the
60 configured command line will be invoked with the following
61 variables available: $LOCAL is set to the name of the temporary
62 file containing the contents of the diff pre-image and $REMOTE is
63 set to the name of the temporary file containing the contents of
64 the diff post-image. $MERGED is the name of the file which is
65 being compared. $BASE is provided for compatibility with custom
66 merge tool commands and has the same value as $MERGED.
67
68 --tool-help
69 Print a list of diff tools that may be used with --tool.
70
71 --[no-]symlinks
72 git difftool's default behavior is to create symlinks to the
73 working tree when run in --dir-diff mode and the right-hand side of
74 the comparison yields the same content as the file in the working
75 tree.
76
77 Specifying --no-symlinks instructs git difftool to create copies
78 instead. --no-symlinks is the default on Windows.
79
80 -x <command>, --extcmd=<command>
81 Specify a custom command for viewing diffs. git-difftool ignores
82 the configured defaults and runs $command $LOCAL $REMOTE when this
83 option is specified. Additionally, $BASE is set in the environment.
84
85 -g, --[no-]gui
86 When git-difftool is invoked with the -g or --gui option the
87 default diff tool will be read from the configured diff.guitool
88 variable instead of diff.tool. This may be selected automatically
89 using the configuration variable difftool.guiDefault. The --no-gui
90 option can be used to override these settings. If diff.guitool is
91 not set, we will fallback in the order of merge.guitool, diff.tool,
92 merge.tool until a tool is found.
93
94 --[no-]trust-exit-code
95 git-difftool invokes a diff tool individually on each file. Errors
96 reported by the diff tool are ignored by default. Use
97 --trust-exit-code to make git-difftool exit when an invoked diff
98 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
103 See git-diff(1) for the full list of supported options.
104
106 git difftool falls back to git mergetool config variables when the
107 difftool equivalents have not been defined.
108
109 Everything above this line in this section isn’t included from the git-
110 config(1) documentation. The content that follows is the same as what’s
111 found there:
112
113 diff.tool
114 Controls which diff tool is used by git-difftool(1). This variable
115 overrides the value configured in merge.tool. The list below shows
116 the valid built-in values. Any other value is treated as a custom
117 diff tool and requires that a corresponding difftool.<tool>.cmd
118 variable is defined.
119
120 diff.guitool
121 Controls which diff tool is used by git-difftool(1) when the
122 -g/--gui flag is specified. This variable overrides the value
123 configured in merge.guitool. The list below shows the valid
124 built-in values. Any other value is treated as a custom diff tool
125 and requires that a corresponding difftool.<guitool>.cmd variable
126 is defined.
127
128 difftool.<tool>.cmd
129 Specify the command to invoke the specified diff tool. The
130 specified command is evaluated in shell with the following
131 variables available: LOCAL is set to the name of the temporary file
132 containing the contents of the diff pre-image and REMOTE is set to
133 the name of the temporary file containing the contents of the diff
134 post-image.
135
136 See the --tool=<tool> option in git-difftool(1) for more details.
137
138 difftool.<tool>.path
139 Override the path for the given tool. This is useful in case your
140 tool is not in the PATH.
141
142 difftool.trustExitCode
143 Exit difftool if the invoked diff tool returns a non-zero exit
144 status.
145
146 See the --trust-exit-code option in git-difftool(1) for more
147 details.
148
149 difftool.prompt
150 Prompt before each invocation of the diff tool.
151
152 difftool.guiDefault
153 Set true to use the diff.guitool by default (equivalent to
154 specifying the --gui argument), or auto to select diff.guitool or
155 diff.tool depending on the presence of a DISPLAY environment
156 variable value. The default is false, where the --gui argument must
157 be provided explicitly for the diff.guitool to be used.
158
160 git-diff(1)
161 Show changes between commits, commit and working tree, etc
162
163 git-mergetool(1)
164 Run merge conflict resolution tools to resolve merge conflicts
165
166 git-config(1)
167 Get and set repository or global options
168
170 Part of the git(1) suite
171
172
173
174Git 2.43.0 11/20/2023 GIT-DIFFTOOL(1)