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 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 create symlinks to the working
73 tree when run in --dir-diff mode and the right-hand side of the
74 comparison yields the same content as the file in the working tree.
75
76 Specifying --no-symlinks instructs git difftool to create copies
77 instead. --no-symlinks is the default on Windows.
78
79 -x <command>, --extcmd=<command>
80 Specify a custom command for viewing diffs. git-difftool ignores
81 the configured defaults and runs $command $LOCAL $REMOTE when this
82 option is specified. Additionally, $BASE is set in the environment.
83
84 -g, --[no-]gui
85 When git-difftool is invoked with the -g or --gui option the
86 default diff tool will be read from the configured diff.guitool
87 variable instead of diff.tool. The --no-gui option can be used to
88 override this setting. If diff.guitool is not set, we will fallback
89 in the order of merge.guitool, diff.tool, merge.tool until a tool
90 is found.
91
92 --[no-]trust-exit-code
93 git-difftool invokes a diff tool individually on each file. Errors
94 reported by the diff tool are ignored by default. Use
95 --trust-exit-code to make git-difftool exit when an invoked diff
96 tool returns a non-zero exit code.
97
98 git-difftool will forward the exit code of the invoked tool when
99 --trust-exit-code is used.
100
101 See git-diff(1) for the full list of supported options.
102
104 git difftool falls back to git mergetool config variables when the
105 difftool equivalents have not been defined.
106
107 Everything above this line in this section isn’t included from the git-
108 config(1) documentation. The content that follows is the same as what’s
109 found there:
110
111 diff.tool
112 Controls which diff tool is used by git-difftool(1). This variable
113 overrides the value configured in merge.tool. The list below shows
114 the valid built-in values. Any other value is treated as a custom
115 diff tool and requires that a corresponding difftool.<tool>.cmd
116 variable is defined.
117
118 diff.guitool
119 Controls which diff tool is used by git-difftool(1) when the
120 -g/--gui flag is specified. This variable overrides the value
121 configured in merge.guitool. The list below shows the valid
122 built-in values. Any other value is treated as a custom diff tool
123 and requires that a corresponding difftool.<guitool>.cmd variable
124 is defined.
125
126 difftool.<tool>.cmd
127 Specify the command to invoke the specified diff tool. The
128 specified command is evaluated in shell with the following
129 variables available: LOCAL is set to the name of the temporary file
130 containing the contents of the diff pre-image and REMOTE is set to
131 the name of the temporary file containing the contents of the diff
132 post-image.
133
134 See the --tool=<tool> option in git-difftool(1) for more details.
135
136 difftool.<tool>.path
137 Override the path for the given tool. This is useful in case your
138 tool is not in the PATH.
139
140 difftool.trustExitCode
141 Exit difftool if the invoked diff tool returns a non-zero exit
142 status.
143
144 See the --trust-exit-code option in git-difftool(1) for more
145 details.
146
147 difftool.prompt
148 Prompt before each invocation of the diff tool.
149
151 git-diff(1)
152 Show changes between commits, commit and working tree, etc
153
154 git-mergetool(1)
155 Run merge conflict resolution tools to resolve merge conflicts
156
157 git-config(1)
158 Get and set repository or global options
159
161 Part of the git(1) suite
162
163
164
165Git 2.39.1 2023-01-13 GIT-DIFFTOOL(1)