Git 2.32
[git] / Documentation / config / diff.txt
1 diff.autoRefreshIndex::
2         When using 'git diff' to compare with work tree
3         files, do not consider stat-only change as changed.
4         Instead, silently run `git update-index --refresh` to
5         update the cached stat information for paths whose
6         contents in the work tree match the contents in the
7         index.  This option defaults to true.  Note that this
8         affects only 'git diff' Porcelain, and not lower level
9         'diff' commands such as 'git diff-files'.
10
11 diff.dirstat::
12         A comma separated list of `--dirstat` parameters specifying the
13         default behavior of the `--dirstat` option to linkgit:git-diff[1]
14         and friends. The defaults can be overridden on the command line
15         (using `--dirstat=<param1,param2,...>`). The fallback defaults
16         (when not changed by `diff.dirstat`) are `changes,noncumulative,3`.
17         The following parameters are available:
18 +
19 --
20 `changes`;;
21         Compute the dirstat numbers by counting the lines that have been
22         removed from the source, or added to the destination. This ignores
23         the amount of pure code movements within a file.  In other words,
24         rearranging lines in a file is not counted as much as other changes.
25         This is the default behavior when no parameter is given.
26 `lines`;;
27         Compute the dirstat numbers by doing the regular line-based diff
28         analysis, and summing the removed/added line counts. (For binary
29         files, count 64-byte chunks instead, since binary files have no
30         natural concept of lines). This is a more expensive `--dirstat`
31         behavior than the `changes` behavior, but it does count rearranged
32         lines within a file as much as other changes. The resulting output
33         is consistent with what you get from the other `--*stat` options.
34 `files`;;
35         Compute the dirstat numbers by counting the number of files changed.
36         Each changed file counts equally in the dirstat analysis. This is
37         the computationally cheapest `--dirstat` behavior, since it does
38         not have to look at the file contents at all.
39 `cumulative`;;
40         Count changes in a child directory for the parent directory as well.
41         Note that when using `cumulative`, the sum of the percentages
42         reported may exceed 100%. The default (non-cumulative) behavior can
43         be specified with the `noncumulative` parameter.
44 <limit>;;
45         An integer parameter specifies a cut-off percent (3% by default).
46         Directories contributing less than this percentage of the changes
47         are not shown in the output.
48 --
49 +
50 Example: The following will count changed files, while ignoring
51 directories with less than 10% of the total amount of changed files,
52 and accumulating child directory counts in the parent directories:
53 `files,10,cumulative`.
54
55 diff.statGraphWidth::
56         Limit the width of the graph part in --stat output. If set, applies
57         to all commands generating --stat output except format-patch.
58
59 diff.context::
60         Generate diffs with <n> lines of context instead of the default
61         of 3. This value is overridden by the -U option.
62
63 diff.interHunkContext::
64         Show the context between diff hunks, up to the specified number
65         of lines, thereby fusing the hunks that are close to each other.
66         This value serves as the default for the `--inter-hunk-context`
67         command line option.
68
69 diff.external::
70         If this config variable is set, diff generation is not
71         performed using the internal diff machinery, but using the
72         given command.  Can be overridden with the `GIT_EXTERNAL_DIFF'
73         environment variable.  The command is called with parameters
74         as described under "git Diffs" in linkgit:git[1].  Note: if
75         you want to use an external diff program only on a subset of
76         your files, you might want to use linkgit:gitattributes[5] instead.
77
78 diff.ignoreSubmodules::
79         Sets the default value of --ignore-submodules. Note that this
80         affects only 'git diff' Porcelain, and not lower level 'diff'
81         commands such as 'git diff-files'. 'git checkout'
82         and 'git switch' also honor
83         this setting when reporting uncommitted changes. Setting it to
84         'all' disables the submodule summary normally shown by 'git commit'
85         and 'git status' when `status.submoduleSummary` is set unless it is
86         overridden by using the --ignore-submodules command-line option.
87         The 'git submodule' commands are not affected by this setting.
88         By default this is set to untracked so that any untracked
89         submodules are ignored.
90
91 diff.mnemonicPrefix::
92         If set, 'git diff' uses a prefix pair that is different from the
93         standard "a/" and "b/" depending on what is being compared.  When
94         this configuration is in effect, reverse diff output also swaps
95         the order of the prefixes:
96 `git diff`;;
97         compares the (i)ndex and the (w)ork tree;
98 `git diff HEAD`;;
99          compares a (c)ommit and the (w)ork tree;
100 `git diff --cached`;;
101         compares a (c)ommit and the (i)ndex;
102 `git diff HEAD:file1 file2`;;
103         compares an (o)bject and a (w)ork tree entity;
104 `git diff --no-index a b`;;
105         compares two non-git things (1) and (2).
106
107 diff.noprefix::
108         If set, 'git diff' does not show any source or destination prefix.
109
110 diff.relative::
111         If set to 'true', 'git diff' does not show changes outside of the directory
112         and show pathnames relative to the current directory.
113
114 diff.orderFile::
115         File indicating how to order files within a diff.
116         See the '-O' option to linkgit:git-diff[1] for details.
117         If `diff.orderFile` is a relative pathname, it is treated as
118         relative to the top of the working tree.
119
120 diff.renameLimit::
121         The number of files to consider when performing the copy/rename
122         detection; equivalent to the 'git diff' option `-l`. This setting
123         has no effect if rename detection is turned off.
124
125 diff.renames::
126         Whether and how Git detects renames.  If set to "false",
127         rename detection is disabled. If set to "true", basic rename
128         detection is enabled.  If set to "copies" or "copy", Git will
129         detect copies, as well.  Defaults to true.  Note that this
130         affects only 'git diff' Porcelain like linkgit:git-diff[1] and
131         linkgit:git-log[1], and not lower level commands such as
132         linkgit:git-diff-files[1].
133
134 diff.suppressBlankEmpty::
135         A boolean to inhibit the standard behavior of printing a space
136         before each empty output line. Defaults to false.
137
138 diff.submodule::
139         Specify the format in which differences in submodules are
140         shown.  The "short" format just shows the names of the commits
141         at the beginning and end of the range. The "log" format lists
142         the commits in the range like linkgit:git-submodule[1] `summary`
143         does. The "diff" format shows an inline diff of the changed
144         contents of the submodule. Defaults to "short".
145
146 diff.wordRegex::
147         A POSIX Extended Regular Expression used to determine what is a "word"
148         when performing word-by-word difference calculations.  Character
149         sequences that match the regular expression are "words", all other
150         characters are *ignorable* whitespace.
151
152 diff.<driver>.command::
153         The custom diff driver command.  See linkgit:gitattributes[5]
154         for details.
155
156 diff.<driver>.xfuncname::
157         The regular expression that the diff driver should use to
158         recognize the hunk header.  A built-in pattern may also be used.
159         See linkgit:gitattributes[5] for details.
160
161 diff.<driver>.binary::
162         Set this option to true to make the diff driver treat files as
163         binary.  See linkgit:gitattributes[5] for details.
164
165 diff.<driver>.textconv::
166         The command that the diff driver should call to generate the
167         text-converted version of a file.  The result of the
168         conversion is used to generate a human-readable diff.  See
169         linkgit:gitattributes[5] for details.
170
171 diff.<driver>.wordRegex::
172         The regular expression that the diff driver should use to
173         split words in a line.  See linkgit:gitattributes[5] for
174         details.
175
176 diff.<driver>.cachetextconv::
177         Set this option to true to make the diff driver cache the text
178         conversion outputs.  See linkgit:gitattributes[5] for details.
179
180 diff.tool::
181         Controls which diff tool is used by linkgit:git-difftool[1].
182         This variable overrides the value configured in `merge.tool`.
183         The list below shows the valid built-in values.
184         Any other value is treated as a custom diff tool and requires
185         that a corresponding difftool.<tool>.cmd variable is defined.
186
187 diff.guitool::
188         Controls which diff tool is used by linkgit:git-difftool[1] when
189         the -g/--gui flag is specified. This variable overrides the value
190         configured in `merge.guitool`. The list below shows the valid
191         built-in values. Any other value is treated as a custom diff tool
192         and requires that a corresponding difftool.<guitool>.cmd variable
193         is defined.
194
195 include::../mergetools-diff.txt[]
196
197 diff.indentHeuristic::
198         Set this option to `false` to disable the default heuristics
199         that shift diff hunk boundaries to make patches easier to read.
200
201 diff.algorithm::
202         Choose a diff algorithm.  The variants are as follows:
203 +
204 --
205 `default`, `myers`;;
206         The basic greedy diff algorithm. Currently, this is the default.
207 `minimal`;;
208         Spend extra time to make sure the smallest possible diff is
209         produced.
210 `patience`;;
211         Use "patience diff" algorithm when generating patches.
212 `histogram`;;
213         This algorithm extends the patience algorithm to "support
214         low-occurrence common elements".
215 --
216 +
217
218 diff.wsErrorHighlight::
219         Highlight whitespace errors in the `context`, `old` or `new`
220         lines of the diff.  Multiple values are separated by comma,
221         `none` resets previous values, `default` reset the list to
222         `new` and `all` is a shorthand for `old,new,context`.  The
223         whitespace errors are colored with `color.diff.whitespace`.
224         The command line option `--ws-error-highlight=<kind>`
225         overrides this setting.
226
227 diff.colorMoved::
228         If set to either a valid `<mode>` or a true value, moved lines
229         in a diff are colored differently, for details of valid modes
230         see '--color-moved' in linkgit:git-diff[1]. If simply set to
231         true the default color mode will be used. When set to false,
232         moved lines are not colored.
233
234 diff.colorMovedWS::
235         When moved lines are colored using e.g. the `diff.colorMoved` setting,
236         this option controls the `<mode>` how spaces are treated
237         for details of valid modes see '--color-moved-ws' in linkgit:git-diff[1].