Sergei Organov | c1a95fa | 2007-11-15 16:19:29 +0300 | [diff] [blame] | 1 | // Please don't remove this comment as asciidoc behaves badly when |
| 2 | // the first non-empty line is ifdef/ifndef. The symptom is that |
| 3 | // without this comment the <git-diff-core> attribute conditionally |
| 4 | // defined below ends up being defined unconditionally. |
| 5 | // Last checked with asciidoc 7.0.2. |
| 6 | |
| 7 | ifndef::git-format-patch[] |
| 8 | ifndef::git-diff[] |
Miklos Vajna | 272bd3c | 2007-11-01 15:57:40 +0100 | [diff] [blame] | 9 | ifndef::git-log[] |
Sergei Organov | c1a95fa | 2007-11-15 16:19:29 +0300 | [diff] [blame] | 10 | :git-diff-core: 1 |
Miklos Vajna | 272bd3c | 2007-11-01 15:57:40 +0100 | [diff] [blame] | 11 | endif::git-log[] |
Sergei Organov | c1a95fa | 2007-11-15 16:19:29 +0300 | [diff] [blame] | 12 | endif::git-diff[] |
| 13 | endif::git-format-patch[] |
| 14 | |
| 15 | ifdef::git-format-patch[] |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 16 | -p:: |
Björn Gustavsson | 2cfa833 | 2009-11-07 10:58:55 +0100 | [diff] [blame] | 17 | --no-stat:: |
Björn Gustavsson | 02bc5b0 | 2009-11-07 10:51:56 +0100 | [diff] [blame] | 18 | Generate plain patches without any diffstats. |
Sergei Organov | c1a95fa | 2007-11-15 16:19:29 +0300 | [diff] [blame] | 19 | endif::git-format-patch[] |
| 20 | |
| 21 | ifndef::git-format-patch[] |
| 22 | -p:: |
jidanni@jidanni.org | a9e67c8 | 2008-12-29 15:03:17 +0800 | [diff] [blame] | 23 | -u:: |
Will Palmer | 1c9eecf | 2010-05-13 09:59:00 +0100 | [diff] [blame] | 24 | --patch:: |
Sergey Organov | 11422f2 | 2023-09-06 10:15:07 +0300 | [diff] [blame] | 25 | Generate patch (see <<generate_patch_text_with_p>>). |
Jeff King | d0258b9 | 2015-05-14 00:34:48 -0400 | [diff] [blame] | 26 | ifdef::git-diff[] |
| 27 | This is the default. |
| 28 | endif::git-diff[] |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 29 | |
Matthieu Moy | 7b02c83 | 2013-07-16 10:05:39 +0200 | [diff] [blame] | 30 | -s:: |
| 31 | --no-patch:: |
Junio C Hamano | 9d484b9 | 2023-05-05 09:59:52 -0700 | [diff] [blame] | 32 | Suppress all output from the diff machinery. Useful for |
| 33 | commands like `git show` that show the patch by default to |
| 34 | squelch their output, or to cancel the effect of options like |
| 35 | `--patch`, `--stat` earlier on the command line in an alias. |
| 36 | |
Eric Sunshine | b73a1bc | 2016-03-27 17:26:07 -0400 | [diff] [blame] | 37 | endif::git-format-patch[] |
Matthieu Moy | 7b02c83 | 2013-07-16 10:05:39 +0200 | [diff] [blame] | 38 | |
Sergey Organov | 1d24509 | 2020-12-21 18:19:59 +0300 | [diff] [blame] | 39 | ifdef::git-log[] |
Sergey Organov | be3820c | 2023-10-09 19:05:33 +0300 | [diff] [blame] | 40 | -m:: |
| 41 | Show diffs for merge commits in the default format. This is |
| 42 | similar to '--diff-merges=on', except `-m` will |
| 43 | produce no output unless `-p` is given as well. |
| 44 | |
| 45 | -c:: |
| 46 | Produce combined diff output for merge commits. |
| 47 | Shortcut for '--diff-merges=combined -p'. |
| 48 | |
| 49 | --cc:: |
| 50 | Produce dense combined diff output for merge commits. |
| 51 | Shortcut for '--diff-merges=dense-combined -p'. |
| 52 | |
Sergey Organov | c8e5cb0 | 2023-10-09 19:05:34 +0300 | [diff] [blame] | 53 | --dd:: |
| 54 | Produce diff with respect to first parent for both merge and |
| 55 | regular commits. |
| 56 | Shortcut for '--diff-merges=first-parent -p'. |
| 57 | |
Sergey Organov | be3820c | 2023-10-09 19:05:33 +0300 | [diff] [blame] | 58 | --remerge-diff:: |
| 59 | Produce remerge-diff output for merge commits. |
| 60 | Shortcut for '--diff-merges=remerge -p'. |
| 61 | |
Sergey Organov | 1d24509 | 2020-12-21 18:19:59 +0300 | [diff] [blame] | 62 | --no-diff-merges:: |
Sergey Organov | be3820c | 2023-10-09 19:05:33 +0300 | [diff] [blame] | 63 | Synonym for '--diff-merges=off'. |
| 64 | |
| 65 | --diff-merges=<format>:: |
Sergey Organov | 1d24509 | 2020-12-21 18:19:59 +0300 | [diff] [blame] | 66 | Specify diff format to be used for merge commits. Default is |
Sergey Organov | be3820c | 2023-10-09 19:05:33 +0300 | [diff] [blame] | 67 | {diff-merges-default} unless `--first-parent` is in use, in |
| 68 | which case `first-parent` is the default. |
Sergey Organov | 1d24509 | 2020-12-21 18:19:59 +0300 | [diff] [blame] | 69 | + |
Sergey Organov | be3820c | 2023-10-09 19:05:33 +0300 | [diff] [blame] | 70 | The following formats are supported: |
| 71 | + |
| 72 | -- |
| 73 | off, none:: |
Sergey Organov | 1d24509 | 2020-12-21 18:19:59 +0300 | [diff] [blame] | 74 | Disable output of diffs for merge commits. Useful to override |
| 75 | implied value. |
| 76 | + |
Sergey Organov | be3820c | 2023-10-09 19:05:33 +0300 | [diff] [blame] | 77 | on, m:: |
| 78 | Make diff output for merge commits to be shown in the default |
Junio C Hamano | 8183b63 | 2023-10-30 07:09:55 +0900 | [diff] [blame] | 79 | format. The default format can be changed using |
Sergey Organov | be3820c | 2023-10-09 19:05:33 +0300 | [diff] [blame] | 80 | `log.diffMerges` configuration variable, whose default value |
Jonathan Nieder | 6a38e33 | 2021-08-05 18:45:23 -0700 | [diff] [blame] | 81 | is `separate`. |
Sergey Organov | 364bc11 | 2021-04-13 14:41:18 +0300 | [diff] [blame] | 82 | + |
Sergey Organov | be3820c | 2023-10-09 19:05:33 +0300 | [diff] [blame] | 83 | first-parent, 1:: |
| 84 | Show full diff with respect to first parent. This is the same |
| 85 | format as `--patch` produces for non-merge commits. |
Sergey Organov | 1d24509 | 2020-12-21 18:19:59 +0300 | [diff] [blame] | 86 | + |
Sergey Organov | be3820c | 2023-10-09 19:05:33 +0300 | [diff] [blame] | 87 | separate:: |
| 88 | Show full diff with respect to each of parents. |
| 89 | Separate log entry and diff is generated for each parent. |
Sergey Organov | 1d24509 | 2020-12-21 18:19:59 +0300 | [diff] [blame] | 90 | + |
Sergey Organov | be3820c | 2023-10-09 19:05:33 +0300 | [diff] [blame] | 91 | combined, c:: |
| 92 | Show differences from each of the parents to the merge |
| 93 | result simultaneously instead of showing pairwise diff between |
| 94 | a parent and the result one at a time. Furthermore, it lists |
| 95 | only files which were modified from all parents. |
| 96 | + |
| 97 | dense-combined, cc:: |
| 98 | Further compress output produced by `--diff-merges=combined` |
| 99 | by omitting uninteresting hunks whose contents in the parents |
| 100 | have only two variants and the merge result picks one of them |
| 101 | without modification. |
| 102 | + |
| 103 | remerge, r:: |
| 104 | Remerge two-parent merge commits to create a temporary tree |
| 105 | object--potentially containing files with conflict markers |
| 106 | and such. A diff is then shown between that temporary tree |
| 107 | and the actual merge commit. |
Elijah Newren | db757e8 | 2022-02-02 02:37:28 +0000 | [diff] [blame] | 108 | + |
| 109 | The output emitted when this option is used is subject to change, and |
| 110 | so is its interaction with other options (unless explicitly |
| 111 | documented). |
Sergey Organov | be3820c | 2023-10-09 19:05:33 +0300 | [diff] [blame] | 112 | -- |
Sergey Organov | 1d24509 | 2020-12-21 18:19:59 +0300 | [diff] [blame] | 113 | |
| 114 | --combined-all-paths:: |
| 115 | This flag causes combined diffs (used for merge commits) to |
| 116 | list the name of the file from all parents. It thus only has |
| 117 | effect when `--diff-merges=[dense-]combined` is in use, and |
| 118 | is likely only useful if filename changes are detected (i.e. |
| 119 | when either rename or copy detection have been requested). |
| 120 | endif::git-log[] |
| 121 | |
Robin Rosenberg | 4eb9947 | 2007-07-25 12:08:17 +0200 | [diff] [blame] | 122 | -U<n>:: |
Robin Rosenberg | 4eb9947 | 2007-07-25 12:08:17 +0200 | [diff] [blame] | 123 | --unified=<n>:: |
| 124 | Generate diffs with <n> lines of context instead of |
Sergey Organov | 714d491 | 2020-10-31 22:37:34 +0300 | [diff] [blame] | 125 | the usual three. |
Björn Gustavsson | 02bc5b0 | 2009-11-07 10:51:56 +0100 | [diff] [blame] | 126 | ifndef::git-format-patch[] |
Sergey Organov | 714d491 | 2020-10-31 22:37:34 +0300 | [diff] [blame] | 127 | Implies `--patch`. |
Björn Gustavsson | 02bc5b0 | 2009-11-07 10:51:56 +0100 | [diff] [blame] | 128 | endif::git-format-patch[] |
Robin Rosenberg | 4eb9947 | 2007-07-25 12:08:17 +0200 | [diff] [blame] | 129 | |
Nguyễn Thái Ngọc Duy | af2f368 | 2019-02-21 18:16:12 +0700 | [diff] [blame] | 130 | --output=<file>:: |
| 131 | Output to a specific file instead of stdout. |
| 132 | |
| 133 | --output-indicator-new=<char>:: |
| 134 | --output-indicator-old=<char>:: |
| 135 | --output-indicator-context=<char>:: |
| 136 | Specify the character used to indicate new, old or context |
| 137 | lines in the generated patch. Normally they are '+', '-' and |
| 138 | ' ' respectively. |
| 139 | |
Björn Gustavsson | d4cb003 | 2009-11-07 10:52:29 +0100 | [diff] [blame] | 140 | ifndef::git-format-patch[] |
Junio C Hamano | b537664 | 2006-07-07 05:28:05 -0700 | [diff] [blame] | 141 | --raw:: |
Matthieu Moy | d89df36 | 2015-05-18 19:55:57 +0200 | [diff] [blame] | 142 | ifndef::git-log[] |
| 143 | Generate the diff in raw format. |
Jeff King | d0258b9 | 2015-05-14 00:34:48 -0400 | [diff] [blame] | 144 | ifdef::git-diff-core[] |
| 145 | This is the default. |
| 146 | endif::git-diff-core[] |
Matthieu Moy | d89df36 | 2015-05-18 19:55:57 +0200 | [diff] [blame] | 147 | endif::git-log[] |
| 148 | ifdef::git-log[] |
| 149 | For each commit, show a summary of changes using the raw diff |
| 150 | format. See the "RAW OUTPUT FORMAT" section of |
| 151 | linkgit:git-diff[1]. This is different from showing the log |
| 152 | itself in raw format, which you can achieve with |
| 153 | `--format=raw`. |
| 154 | endif::git-log[] |
Björn Gustavsson | d4cb003 | 2009-11-07 10:52:29 +0100 | [diff] [blame] | 155 | endif::git-format-patch[] |
Junio C Hamano | b537664 | 2006-07-07 05:28:05 -0700 | [diff] [blame] | 156 | |
Björn Gustavsson | 02bc5b0 | 2009-11-07 10:51:56 +0100 | [diff] [blame] | 157 | ifndef::git-format-patch[] |
Petr Baudis | 5c91da2 | 2006-04-11 13:22:17 +0200 | [diff] [blame] | 158 | --patch-with-raw:: |
Björn Gustavsson | dce5ef1 | 2009-11-07 10:53:07 +0100 | [diff] [blame] | 159 | Synonym for `-p --raw`. |
Björn Gustavsson | 02bc5b0 | 2009-11-07 10:51:56 +0100 | [diff] [blame] | 160 | endif::git-format-patch[] |
Petr Baudis | 5c91da2 | 2006-04-11 13:22:17 +0200 | [diff] [blame] | 161 | |
Jeff King | 9a6d515 | 2020-07-29 16:12:10 -0400 | [diff] [blame] | 162 | ifdef::git-log[] |
| 163 | -t:: |
| 164 | Show the tree objects in the diff output. |
| 165 | endif::git-log[] |
| 166 | |
Carlos Martín Nieto | bab7614 | 2017-10-29 16:12:28 +0100 | [diff] [blame] | 167 | --indent-heuristic:: |
Robert P. J. Day | 7eedad1 | 2018-06-11 09:56:13 -0400 | [diff] [blame] | 168 | Enable the heuristic that shifts diff hunk boundaries to make patches |
Carlos Martín Nieto | bab7614 | 2017-10-29 16:12:28 +0100 | [diff] [blame] | 169 | easier to read. This is the default. |
| 170 | |
| 171 | --no-indent-heuristic:: |
| 172 | Disable the indent heuristic. |
Junio C Hamano | 5580b27 | 2016-06-10 10:58:55 -0700 | [diff] [blame] | 173 | |
Junio C Hamano | 81b568c | 2011-10-01 21:56:28 -0700 | [diff] [blame] | 174 | --minimal:: |
| 175 | Spend extra time to make sure the smallest possible |
| 176 | diff is produced. |
| 177 | |
Teemu Likonen | ec74042 | 2009-01-25 14:20:22 +0200 | [diff] [blame] | 178 | --patience:: |
Johannes Schindelin | 34292bd | 2009-01-01 17:39:17 +0100 | [diff] [blame] | 179 | Generate a diff using the "patience diff" algorithm. |
| 180 | |
Thomas Rast | d909e07 | 2012-03-06 14:15:02 +0100 | [diff] [blame] | 181 | --histogram:: |
| 182 | Generate a diff using the "histogram diff" algorithm. |
| 183 | |
Jonathan Tan | 2477ab2 | 2017-11-27 11:47:47 -0800 | [diff] [blame] | 184 | --anchored=<text>:: |
| 185 | Generate a diff using the "anchored diff" algorithm. |
| 186 | + |
| 187 | This option may be specified more than once. |
| 188 | + |
| 189 | If a line exists in both the source and destination, exists only once, |
| 190 | and starts with this text, this algorithm attempts to prevent it from |
| 191 | appearing as a deletion or addition in the output. It uses the "patience |
| 192 | diff" algorithm internally. |
| 193 | |
Michal Privoznik | 07924d4 | 2013-01-16 08:51:58 +0100 | [diff] [blame] | 194 | --diff-algorithm={patience|minimal|histogram|myers}:: |
| 195 | Choose a diff algorithm. The variants are as follows: |
| 196 | + |
| 197 | -- |
| 198 | `default`, `myers`;; |
| 199 | The basic greedy diff algorithm. Currently, this is the default. |
| 200 | `minimal`;; |
| 201 | Spend extra time to make sure the smallest possible diff is |
| 202 | produced. |
| 203 | `patience`;; |
| 204 | Use "patience diff" algorithm when generating patches. |
| 205 | `histogram`;; |
| 206 | This algorithm extends the patience algorithm to "support |
| 207 | low-occurrence common elements". |
| 208 | -- |
| 209 | + |
Robert P. J. Day | 7eedad1 | 2018-06-11 09:56:13 -0400 | [diff] [blame] | 210 | For instance, if you configured the `diff.algorithm` variable to a |
Michal Privoznik | 07924d4 | 2013-01-16 08:51:58 +0100 | [diff] [blame] | 211 | non-default value and want to use the default one, then you |
| 212 | have to use `--diff-algorithm=default` option. |
| 213 | |
Michael J Gruber | 808e1db | 2011-05-27 14:36:41 +0200 | [diff] [blame] | 214 | --stat[=<width>[,<name-width>[,<count>]]]:: |
Zbigniew Jędrzejewski-Szmek | 1b058bc | 2012-03-01 13:26:43 +0100 | [diff] [blame] | 215 | Generate a diffstat. By default, as much space as necessary |
Zbigniew Jędrzejewski-Szmek | df44483 | 2012-03-01 13:26:46 +0100 | [diff] [blame] | 216 | will be used for the filename part, and the rest for the graph |
| 217 | part. Maximum width defaults to terminal width, or 80 columns |
Leila Muhtasib | 8d8136c | 2012-06-22 16:03:01 -0400 | [diff] [blame] | 218 | if not connected to a terminal, and can be overridden by |
Zbigniew Jędrzejewski-Szmek | df44483 | 2012-03-01 13:26:46 +0100 | [diff] [blame] | 219 | `<width>`. The width of the filename part can be limited by |
Dragan Simic | bd48adc | 2023-09-11 17:39:44 +0200 | [diff] [blame] | 220 | giving another width `<name-width>` after a comma or by setting |
| 221 | `diff.statNameWidth=<width>`. The width of the graph part can be |
| 222 | limited by using `--stat-graph-width=<width>` or by setting |
| 223 | `diff.statGraphWidth=<width>`. Using `--stat` or |
| 224 | `--stat-graph-width` affects all commands generating a stat graph, |
| 225 | while setting `diff.statNameWidth` or `diff.statGraphWidth` |
| 226 | does not affect `git format-patch`. |
| 227 | By giving a third parameter `<count>`, you can limit the output to |
| 228 | the first `<count>` lines, followed by `...` if there are more. |
Michael J Gruber | 86e1ce96 | 2011-05-27 14:36:42 +0200 | [diff] [blame] | 229 | + |
| 230 | These parameters can also be set individually with `--stat-width=<width>`, |
| 231 | `--stat-name-width=<name-width>` and `--stat-count=<count>`. |
Johannes Schindelin | d75f795 | 2006-04-14 00:15:30 +0200 | [diff] [blame] | 232 | |
Nguyễn Thái Ngọc Duy | ddf88fa | 2018-02-24 21:09:59 +0700 | [diff] [blame] | 233 | --compact-summary:: |
| 234 | Output a condensed summary of extended header information such |
| 235 | as file creations or deletions ("new" or "gone", optionally "+l" |
| 236 | if it's a symlink) and mode changes ("+x" or "-x" for adding |
| 237 | or removing executable bit respectively) in diffstat. The |
Karthikeyan Singaravelan | 1f2abe6 | 2018-06-17 04:35:54 +0000 | [diff] [blame] | 238 | information is put between the filename part and the graph |
Nguyễn Thái Ngọc Duy | ddf88fa | 2018-02-24 21:09:59 +0700 | [diff] [blame] | 239 | part. Implies `--stat`. |
| 240 | |
Junio C Hamano | 74e2abe | 2006-10-12 03:01:00 -0700 | [diff] [blame] | 241 | --numstat:: |
Jeff King | 6cf378f | 2012-04-26 04:51:57 -0400 | [diff] [blame] | 242 | Similar to `--stat`, but shows number of added and |
Junio C Hamano | 74e2abe | 2006-10-12 03:01:00 -0700 | [diff] [blame] | 243 | deleted lines in decimal notation and pathname without |
Junio C Hamano | 2f89543 | 2006-12-26 00:15:26 -0800 | [diff] [blame] | 244 | abbreviation, to make it more machine friendly. For |
| 245 | binary files, outputs two `-` instead of saying |
| 246 | `0 0`. |
Junio C Hamano | 74e2abe | 2006-10-12 03:01:00 -0700 | [diff] [blame] | 247 | |
Nicolas Pitre | ebd124c | 2006-12-14 23:15:44 -0500 | [diff] [blame] | 248 | --shortstat:: |
Björn Gustavsson | dce5ef1 | 2009-11-07 10:53:07 +0100 | [diff] [blame] | 249 | Output only the last line of the `--stat` format containing total |
Nicolas Pitre | ebd124c | 2006-12-14 23:15:44 -0500 | [diff] [blame] | 250 | number of modified files, as well as number of added and deleted |
| 251 | lines. |
| 252 | |
Nguyễn Thái Ngọc Duy | 4ce7aab | 2019-02-21 18:16:03 +0700 | [diff] [blame] | 253 | -X[<param1,param2,...>]:: |
Johan Herland | 333f3fb | 2011-04-29 11:36:18 +0200 | [diff] [blame] | 254 | --dirstat[=<param1,param2,...>]:: |
| 255 | Output the distribution of relative amount of changes for each |
| 256 | sub-directory. The behavior of `--dirstat` can be customized by |
| 257 | passing it a comma separated list of parameters. |
Johan Herland | 2d17495 | 2011-04-29 11:36:19 +0200 | [diff] [blame] | 258 | The defaults are controlled by the `diff.dirstat` configuration |
| 259 | variable (see linkgit:git-config[1]). |
Johan Herland | 333f3fb | 2011-04-29 11:36:18 +0200 | [diff] [blame] | 260 | The following parameters are available: |
Johan Herland | 204f01a | 2011-04-11 00:48:50 +0200 | [diff] [blame] | 261 | + |
Johan Herland | 333f3fb | 2011-04-29 11:36:18 +0200 | [diff] [blame] | 262 | -- |
| 263 | `changes`;; |
| 264 | Compute the dirstat numbers by counting the lines that have been |
| 265 | removed from the source, or added to the destination. This ignores |
| 266 | the amount of pure code movements within a file. In other words, |
| 267 | rearranging lines in a file is not counted as much as other changes. |
| 268 | This is the default behavior when no parameter is given. |
Johan Herland | 1c57a62 | 2011-04-29 11:36:21 +0200 | [diff] [blame] | 269 | `lines`;; |
| 270 | Compute the dirstat numbers by doing the regular line-based diff |
| 271 | analysis, and summing the removed/added line counts. (For binary |
| 272 | files, count 64-byte chunks instead, since binary files have no |
| 273 | natural concept of lines). This is a more expensive `--dirstat` |
| 274 | behavior than the `changes` behavior, but it does count rearranged |
| 275 | lines within a file as much as other changes. The resulting output |
| 276 | is consistent with what you get from the other `--*stat` options. |
Johan Herland | 333f3fb | 2011-04-29 11:36:18 +0200 | [diff] [blame] | 277 | `files`;; |
| 278 | Compute the dirstat numbers by counting the number of files changed. |
| 279 | Each changed file counts equally in the dirstat analysis. This is |
| 280 | the computationally cheapest `--dirstat` behavior, since it does |
| 281 | not have to look at the file contents at all. |
| 282 | `cumulative`;; |
| 283 | Count changes in a child directory for the parent directory as well. |
| 284 | Note that when using `cumulative`, the sum of the percentages |
| 285 | reported may exceed 100%. The default (non-cumulative) behavior can |
| 286 | be specified with the `noncumulative` parameter. |
| 287 | <limit>;; |
| 288 | An integer parameter specifies a cut-off percent (3% by default). |
| 289 | Directories contributing less than this percentage of the changes |
| 290 | are not shown in the output. |
| 291 | -- |
| 292 | + |
| 293 | Example: The following will count changed files, while ignoring |
| 294 | directories with less than 10% of the total amount of changed files, |
| 295 | and accumulating child directory counts in the parent directories: |
| 296 | `--dirstat=files,10,cumulative`. |
Heikki Orsila | fd33777 | 2008-09-05 22:27:35 +0300 | [diff] [blame] | 297 | |
Nguyễn Thái Ngọc Duy | 4ce7aab | 2019-02-21 18:16:03 +0700 | [diff] [blame] | 298 | --cumulative:: |
| 299 | Synonym for --dirstat=cumulative |
| 300 | |
| 301 | --dirstat-by-file[=<param1,param2>...]:: |
Jean-Noël Avila | 51e846e | 2023-12-25 21:21:27 +0000 | [diff] [blame] | 302 | Synonym for --dirstat=files,<param1>,<param2>... |
Nguyễn Thái Ngọc Duy | 4ce7aab | 2019-02-21 18:16:03 +0700 | [diff] [blame] | 303 | |
Sean | 4bbd261 | 2006-05-14 08:13:49 -0400 | [diff] [blame] | 304 | --summary:: |
| 305 | Output a condensed summary of extended header information |
| 306 | such as creations, renames and mode changes. |
| 307 | |
Björn Gustavsson | 02bc5b0 | 2009-11-07 10:51:56 +0100 | [diff] [blame] | 308 | ifndef::git-format-patch[] |
Johannes Schindelin | 2935327 | 2006-04-15 13:41:18 +0200 | [diff] [blame] | 309 | --patch-with-stat:: |
Björn Gustavsson | dce5ef1 | 2009-11-07 10:53:07 +0100 | [diff] [blame] | 310 | Synonym for `-p --stat`. |
Björn Gustavsson | 02bc5b0 | 2009-11-07 10:51:56 +0100 | [diff] [blame] | 311 | endif::git-format-patch[] |
Johannes Schindelin | 2935327 | 2006-04-15 13:41:18 +0200 | [diff] [blame] | 312 | |
Björn Gustavsson | d4cb003 | 2009-11-07 10:52:29 +0100 | [diff] [blame] | 313 | ifndef::git-format-patch[] |
Björn Gustavsson | 64485b4 | 2009-11-22 20:43:20 +0100 | [diff] [blame] | 314 | |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 315 | -z:: |
Björn Gustavsson | 5c931c8 | 2009-11-23 08:40:24 +0100 | [diff] [blame] | 316 | ifdef::git-log[] |
Štěpán Němec | 97509a3 | 2023-10-05 11:00:51 +0200 | [diff] [blame] | 317 | Separate the commits with NULs instead of newlines. |
Björn Gustavsson | 5c931c8 | 2009-11-23 08:40:24 +0100 | [diff] [blame] | 318 | + |
| 319 | Also, when `--raw` or `--numstat` has been given, do not munge |
| 320 | pathnames and use NULs as output field terminators. |
| 321 | endif::git-log[] |
Björn Gustavsson | 64485b4 | 2009-11-22 20:43:20 +0100 | [diff] [blame] | 322 | ifndef::git-log[] |
Charles Bailey | 03aa87e | 2010-04-18 19:28:17 +0100 | [diff] [blame] | 323 | When `--raw`, `--numstat`, `--name-only` or `--name-status` has been |
| 324 | given, do not munge pathnames and use NULs as output field terminators. |
Björn Gustavsson | 5c931c8 | 2009-11-23 08:40:24 +0100 | [diff] [blame] | 325 | endif::git-log[] |
Björn Gustavsson | 64485b4 | 2009-11-22 20:43:20 +0100 | [diff] [blame] | 326 | + |
Andreas Heiduk | 860cd69 | 2017-03-02 20:03:52 +0100 | [diff] [blame] | 327 | Without this option, pathnames with "unusual" characters are quoted as |
| 328 | explained for the configuration variable `core.quotePath` (see |
| 329 | linkgit:git-config[1]). |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 330 | |
| 331 | --name-only:: |
Junio C Hamano | 4986662 | 2024-05-17 10:14:46 -0700 | [diff] [blame] | 332 | Show only the name of each changed file in the post-image tree. |
| 333 | The file names are often encoded in UTF-8. |
Andrey Bienkowski | 9364bf4 | 2021-04-20 11:24:37 +0000 | [diff] [blame] | 334 | For more information see the discussion about encoding in the linkgit:git-log[1] |
| 335 | manual page. |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 336 | |
Junio C Hamano | 946f5f7 | 2005-09-21 00:20:06 -0700 | [diff] [blame] | 337 | --name-status:: |
Junio C Hamano | 4986662 | 2024-05-17 10:14:46 -0700 | [diff] [blame] | 338 | Show only the name(s) and status of each changed file. See the description |
Miklos Vajna | a6f47b2 | 2008-04-22 14:23:48 +0200 | [diff] [blame] | 339 | of the `--diff-filter` option on what the status letters mean. |
Andrey Bienkowski | 9364bf4 | 2021-04-20 11:24:37 +0000 | [diff] [blame] | 340 | Just like `--name-only` the file names are often encoded in UTF-8. |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 341 | |
Johannes Schindelin | 752c0c2 | 2009-10-19 14:38:32 +0200 | [diff] [blame] | 342 | --submodule[=<format>]:: |
Jacob Keller | fd47ae6 | 2016-08-31 16:27:25 -0700 | [diff] [blame] | 343 | Specify how differences in submodules are shown. When specifying |
| 344 | `--submodule=short` the 'short' format is used. This format just |
| 345 | shows the names of the commits at the beginning and end of the range. |
| 346 | When `--submodule` or `--submodule=log` is specified, the 'log' |
| 347 | format is used. This format lists the commits in the range like |
| 348 | linkgit:git-submodule[1] `summary` does. When `--submodule=diff` |
| 349 | is specified, the 'diff' format is used. This format shows an |
| 350 | inline diff of the changes in the submodule contents between the |
| 351 | commit range. Defaults to `diff.submodule` or the 'short' format |
| 352 | if the config option is unset. |
Johannes Schindelin | 752c0c2 | 2009-10-19 14:38:32 +0200 | [diff] [blame] | 353 | |
Mark Lodato | 73e9da0 | 2010-02-16 23:55:58 -0500 | [diff] [blame] | 354 | --color[=<when>]:: |
Junio C Hamano | b537664 | 2006-07-07 05:28:05 -0700 | [diff] [blame] | 355 | Show colored diff. |
Junio C Hamano | 3d0e75f | 2013-02-22 22:24:10 -0800 | [diff] [blame] | 356 | `--color` (i.e. without '=<when>') is the same as `--color=always`. |
| 357 | '<when>' can be one of `always`, `never`, or `auto`. |
Michael J Gruber | 6999c54 | 2011-04-27 09:38:27 +0200 | [diff] [blame] | 358 | ifdef::git-diff[] |
| 359 | It can be changed by the `color.ui` and `color.diff` |
| 360 | configuration settings. |
| 361 | endif::git-diff[] |
Junio C Hamano | b537664 | 2006-07-07 05:28:05 -0700 | [diff] [blame] | 362 | |
| 363 | --no-color:: |
Michael J Gruber | 6999c54 | 2011-04-27 09:38:27 +0200 | [diff] [blame] | 364 | Turn off colored diff. |
| 365 | ifdef::git-diff[] |
| 366 | This can be used to override configuration settings. |
| 367 | endif::git-diff[] |
| 368 | It is the same as `--color=never`. |
Junio C Hamano | b537664 | 2006-07-07 05:28:05 -0700 | [diff] [blame] | 369 | |
Stefan Beller | 61e89ea | 2017-06-30 13:53:10 -0700 | [diff] [blame] | 370 | --color-moved[=<mode>]:: |
| 371 | Moved lines of code are colored differently. |
| 372 | ifdef::git-diff[] |
| 373 | It can be changed by the `diff.colorMoved` configuration setting. |
| 374 | endif::git-diff[] |
| 375 | The <mode> defaults to 'no' if the option is not given |
| 376 | and to 'zebra' if the option with no mode is given. |
| 377 | The mode must be one of: |
| 378 | + |
| 379 | -- |
| 380 | no:: |
| 381 | Moved lines are not highlighted. |
| 382 | default:: |
| 383 | Is a synonym for `zebra`. This may change to a more sensible mode |
| 384 | in the future. |
| 385 | plain:: |
| 386 | Any line that is added in one location and was removed |
| 387 | in another location will be colored with 'color.diff.newMoved'. |
| 388 | Similarly 'color.diff.oldMoved' will be used for removed lines |
| 389 | that are added somewhere else in the diff. This mode picks up any |
| 390 | moved line, but it is not very useful in a review to determine |
| 391 | if a block of code was moved without permutation. |
Stefan Beller | 51da15e | 2018-07-16 16:05:39 -0700 | [diff] [blame] | 392 | blocks:: |
Jonathan Tan | f0b8fb6 | 2017-08-15 18:27:39 -0700 | [diff] [blame] | 393 | Blocks of moved text of at least 20 alphanumeric characters |
| 394 | are detected greedily. The detected blocks are |
Stefan Beller | 51da15e | 2018-07-16 16:05:39 -0700 | [diff] [blame] | 395 | painted using either the 'color.diff.{old,new}Moved' color. |
| 396 | Adjacent blocks cannot be told apart. |
| 397 | zebra:: |
| 398 | Blocks of moved text are detected as in 'blocks' mode. The blocks |
| 399 | are painted using either the 'color.diff.{old,new}Moved' color or |
Stefan Beller | 61e89ea | 2017-06-30 13:53:10 -0700 | [diff] [blame] | 400 | 'color.diff.{old,new}MovedAlternative'. The change between |
Jonathan Tan | f0b8fb6 | 2017-08-15 18:27:39 -0700 | [diff] [blame] | 401 | the two colors indicates that a new block was detected. |
Eric Sunshine | e3f2f5f | 2018-07-24 17:58:45 -0400 | [diff] [blame] | 402 | dimmed-zebra:: |
Stefan Beller | 61e89ea | 2017-06-30 13:53:10 -0700 | [diff] [blame] | 403 | Similar to 'zebra', but additional dimming of uninteresting parts |
| 404 | of moved code is performed. The bordering lines of two adjacent |
| 405 | blocks are considered interesting, the rest is uninteresting. |
Eric Sunshine | e3f2f5f | 2018-07-24 17:58:45 -0400 | [diff] [blame] | 406 | `dimmed_zebra` is a deprecated synonym. |
Stefan Beller | 61e89ea | 2017-06-30 13:53:10 -0700 | [diff] [blame] | 407 | -- |
| 408 | |
Phillip Wood | fbafb7c | 2018-11-23 11:16:50 +0000 | [diff] [blame] | 409 | --no-color-moved:: |
| 410 | Turn off move detection. This can be used to override configuration |
| 411 | settings. It is the same as `--color-moved=no`. |
| 412 | |
Stefan Beller | b309571 | 2018-07-16 16:05:40 -0700 | [diff] [blame] | 413 | --color-moved-ws=<modes>:: |
Phillip Wood | 748aa1a | 2018-11-23 11:16:51 +0000 | [diff] [blame] | 414 | This configures how whitespace is ignored when performing the |
Stefan Beller | 626c0b5 | 2018-07-18 12:31:56 -0700 | [diff] [blame] | 415 | move detection for `--color-moved`. |
| 416 | ifdef::git-diff[] |
| 417 | It can be set by the `diff.colorMovedWS` configuration setting. |
| 418 | endif::git-diff[] |
| 419 | These modes can be given as a comma separated list: |
Stefan Beller | b309571 | 2018-07-16 16:05:40 -0700 | [diff] [blame] | 420 | + |
| 421 | -- |
Phillip Wood | b73bcba | 2018-11-23 11:16:52 +0000 | [diff] [blame] | 422 | no:: |
| 423 | Do not ignore whitespace when performing move detection. |
Stefan Beller | b309571 | 2018-07-16 16:05:40 -0700 | [diff] [blame] | 424 | ignore-space-at-eol:: |
| 425 | Ignore changes in whitespace at EOL. |
| 426 | ignore-space-change:: |
| 427 | Ignore changes in amount of whitespace. This ignores whitespace |
| 428 | at line end, and considers all other sequences of one or |
| 429 | more whitespace characters to be equivalent. |
| 430 | ignore-all-space:: |
| 431 | Ignore whitespace when comparing lines. This ignores differences |
| 432 | even if one line has whitespace where the other line has none. |
Stefan Beller | ca1f4ae | 2018-07-18 12:31:55 -0700 | [diff] [blame] | 433 | allow-indentation-change:: |
Phillip Wood | 748aa1a | 2018-11-23 11:16:51 +0000 | [diff] [blame] | 434 | Initially ignore any whitespace in the move detection, then |
Stefan Beller | ca1f4ae | 2018-07-18 12:31:55 -0700 | [diff] [blame] | 435 | group the moved code blocks only into a block if the change in |
| 436 | whitespace is the same per line. This is incompatible with the |
| 437 | other modes. |
Stefan Beller | b309571 | 2018-07-16 16:05:40 -0700 | [diff] [blame] | 438 | -- |
| 439 | |
Phillip Wood | b73bcba | 2018-11-23 11:16:52 +0000 | [diff] [blame] | 440 | --no-color-moved-ws:: |
| 441 | Do not ignore whitespace when performing move detection. This can be |
| 442 | used to override configuration settings. It is the same as |
| 443 | `--color-moved-ws=no`. |
| 444 | |
Thomas Rast | 882749a | 2010-04-14 17:59:06 +0200 | [diff] [blame] | 445 | --word-diff[=<mode>]:: |
| 446 | Show a word diff, using the <mode> to delimit changed words. |
| 447 | By default, words are delimited by whitespace; see |
| 448 | `--word-diff-regex` below. The <mode> defaults to 'plain', and |
| 449 | must be one of: |
Johannes Schindelin | 2b6a541 | 2009-01-17 17:29:45 +0100 | [diff] [blame] | 450 | + |
Thomas Rast | 882749a | 2010-04-14 17:59:06 +0200 | [diff] [blame] | 451 | -- |
| 452 | color:: |
| 453 | Highlight changed words using only colors. Implies `--color`. |
| 454 | plain:: |
| 455 | Show words as `[-removed-]` and `{+added+}`. Makes no |
| 456 | attempts to escape the delimiters if they appear in the input, |
| 457 | so the output may be ambiguous. |
| 458 | porcelain:: |
| 459 | Use a special line-based format intended for script |
| 460 | consumption. Added/removed/unchanged runs are printed in the |
| 461 | usual unified diff format, starting with a `+`/`-`/` ` |
| 462 | character at the beginning of the line and extending to the |
| 463 | end of the line. Newlines in the input are represented by a |
| 464 | tilde `~` on a line of its own. |
| 465 | none:: |
| 466 | Disable word diff again. |
| 467 | -- |
| 468 | + |
| 469 | Note that despite the name of the first mode, color is used to |
| 470 | highlight the changed parts in all modes if enabled. |
| 471 | |
| 472 | --word-diff-regex=<regex>:: |
| 473 | Use <regex> to decide what a word is, instead of considering |
| 474 | runs of non-whitespace to be a word. Also implies |
| 475 | `--word-diff` unless it was already enabled. |
| 476 | + |
| 477 | Every non-overlapping match of the |
Thomas Rast | c4b252c | 2009-01-17 17:29:47 +0100 | [diff] [blame] | 478 | <regex> is considered a word. Anything between these matches is |
| 479 | considered whitespace and ignored(!) for the purposes of finding |
| 480 | differences. You may want to append `|[^[:space:]]` to your regular |
| 481 | expression to make sure that it matches all non-whitespace characters. |
| 482 | A match that contains a newline is silently truncated(!) at the |
| 483 | newline. |
Thomas Rast | 80c49c3 | 2009-01-17 17:29:48 +0100 | [diff] [blame] | 484 | + |
Michael J Gruber | 2c15c00 | 2015-11-20 14:36:14 +0100 | [diff] [blame] | 485 | For example, `--word-diff-regex=.` will treat each character as a word |
| 486 | and, correspondingly, show differences character by character. |
| 487 | + |
Boyd Stephen Smith Jr | 98a4d87 | 2009-01-20 21:46:57 -0600 | [diff] [blame] | 488 | The regex can also be set via a diff driver or configuration option, see |
Junio C Hamano | 1cca17d | 2016-05-04 10:36:24 -0700 | [diff] [blame] | 489 | linkgit:gitattributes[5] or linkgit:git-config[1]. Giving it explicitly |
Boyd Stephen Smith Jr | 98a4d87 | 2009-01-20 21:46:57 -0600 | [diff] [blame] | 490 | overrides any diff driver or configuration setting. Diff drivers |
| 491 | override configuration settings. |
Thomas Rast | 882749a | 2010-04-14 17:59:06 +0200 | [diff] [blame] | 492 | |
| 493 | --color-words[=<regex>]:: |
| 494 | Equivalent to `--word-diff=color` plus (if a regex was |
| 495 | specified) `--word-diff-regex=<regex>`. |
Björn Gustavsson | d4cb003 | 2009-11-07 10:52:29 +0100 | [diff] [blame] | 496 | endif::git-format-patch[] |
Johannes Schindelin | f59a59e | 2006-07-28 23:56:15 +0200 | [diff] [blame] | 497 | |
Junio C Hamano | b537664 | 2006-07-07 05:28:05 -0700 | [diff] [blame] | 498 | --no-renames:: |
| 499 | Turn off rename detection, even when the configuration |
| 500 | file gives the default to do so. |
| 501 | |
Nguyễn Thái Ngọc Duy | cdc43eb | 2019-02-21 18:16:18 +0700 | [diff] [blame] | 502 | --[no-]rename-empty:: |
| 503 | Whether to use empty blobs as rename source. |
| 504 | |
Björn Gustavsson | 02bc5b0 | 2009-11-07 10:51:56 +0100 | [diff] [blame] | 505 | ifndef::git-format-patch[] |
Bill Lear | 16507fc | 2007-01-27 07:21:53 -0600 | [diff] [blame] | 506 | --check:: |
Ori Avtalion | 30211fb | 2016-03-29 21:59:45 +0300 | [diff] [blame] | 507 | Warn if changes introduce conflict markers or whitespace errors. |
| 508 | What are considered whitespace errors is controlled by `core.whitespace` |
Christof Krüger | 4f83039 | 2011-06-22 17:33:02 +0200 | [diff] [blame] | 509 | configuration. By default, trailing whitespaces (including |
Robert P. J. Day | 7eedad1 | 2018-06-11 09:56:13 -0400 | [diff] [blame] | 510 | lines that consist solely of whitespaces) and a space character |
Christof Krüger | 4f83039 | 2011-06-22 17:33:02 +0200 | [diff] [blame] | 511 | that is immediately followed by a tab character inside the |
| 512 | initial indent of the line are considered whitespace errors. |
| 513 | Exits with non-zero status if problems are found. Not compatible |
| 514 | with --exit-code. |
Junio C Hamano | b8767f7 | 2015-05-26 10:11:28 -0700 | [diff] [blame] | 515 | |
| 516 | --ws-error-highlight=<kind>:: |
Andreas Heiduk | c0bb6d9 | 2017-07-25 22:53:15 +0200 | [diff] [blame] | 517 | Highlight whitespace errors in the `context`, `old` or `new` |
| 518 | lines of the diff. Multiple values are separated by comma, |
| 519 | `none` resets previous values, `default` reset the list to |
| 520 | `new` and `all` is a shorthand for `old,new,context`. When |
| 521 | this option is not given, and the configuration variable |
| 522 | `diff.wsErrorHighlight` is not set, only whitespace errors in |
| 523 | `new` lines are highlighted. The whitespace errors are colored |
Robert P. J. Day | 7eedad1 | 2018-06-11 09:56:13 -0400 | [diff] [blame] | 524 | with `color.diff.whitespace`. |
Junio C Hamano | b8767f7 | 2015-05-26 10:11:28 -0700 | [diff] [blame] | 525 | |
Björn Gustavsson | 02bc5b0 | 2009-11-07 10:51:56 +0100 | [diff] [blame] | 526 | endif::git-format-patch[] |
Bill Lear | 16507fc | 2007-01-27 07:21:53 -0600 | [diff] [blame] | 527 | |
Junio C Hamano | 80b1e51 | 2005-11-14 17:53:22 -0800 | [diff] [blame] | 528 | --full-index:: |
Jim Meyering | 6457e58 | 2008-07-02 09:49:59 +0200 | [diff] [blame] | 529 | Instead of the first handful of characters, show the full |
| 530 | pre- and post-image blob object names on the "index" |
| 531 | line when generating patch format output. |
Junio C Hamano | b537664 | 2006-07-07 05:28:05 -0700 | [diff] [blame] | 532 | |
| 533 | --binary:: |
Björn Gustavsson | dce5ef1 | 2009-11-07 10:53:07 +0100 | [diff] [blame] | 534 | In addition to `--full-index`, output a binary diff that |
Sergey Organov | 714d491 | 2020-10-31 22:37:34 +0300 | [diff] [blame] | 535 | can be applied with `git-apply`. |
| 536 | ifndef::git-format-patch[] |
| 537 | Implies `--patch`. |
| 538 | endif::git-format-patch[] |
Junio C Hamano | 80b1e51 | 2005-11-14 17:53:22 -0800 | [diff] [blame] | 539 | |
Junio C Hamano | 913419f | 2005-12-18 02:03:15 -0800 | [diff] [blame] | 540 | --abbrev[=<n>]:: |
Junio C Hamano | 47dd0d5 | 2005-12-13 17:21:41 -0800 | [diff] [blame] | 541 | Instead of showing the full 40-byte hexadecimal object |
| 542 | name in diff-raw format output and diff-tree header |
Junio C Hamano | cda34e0 | 2020-11-04 14:01:37 -0800 | [diff] [blame] | 543 | lines, show the shortest prefix that is at least '<n>' |
| 544 | hexdigits long that uniquely refers the object. |
Đoàn Trần Công Danh | 3046c7f | 2020-08-21 18:51:47 +0700 | [diff] [blame] | 545 | In diff-patch output format, `--full-index` takes higher |
| 546 | precedence, i.e. if `--full-index` is specified, full blob |
| 547 | names will be shown regardless of `--abbrev`. |
| 548 | Non default number of digits can be specified with `--abbrev=<n>`. |
Junio C Hamano | 47dd0d5 | 2005-12-13 17:21:41 -0800 | [diff] [blame] | 549 | |
Matthieu Moy | cf958af | 2010-08-05 18:14:25 +0200 | [diff] [blame] | 550 | -B[<n>][/<m>]:: |
Kevin Ballard | 37ab515 | 2010-09-27 16:58:26 -0700 | [diff] [blame] | 551 | --break-rewrites[=[<n>][/<m>]]:: |
Matthieu Moy | cf958af | 2010-08-05 18:14:25 +0200 | [diff] [blame] | 552 | Break complete rewrite changes into pairs of delete and |
| 553 | create. This serves two purposes: |
| 554 | + |
| 555 | It affects the way a change that amounts to a total rewrite of a file |
| 556 | not as a series of deletion and insertion mixed together with a very |
| 557 | few lines that happen to match textually as the context, but as a |
| 558 | single deletion of everything old followed by a single insertion of |
| 559 | everything new, and the number `m` controls this aspect of the -B |
| 560 | option (defaults to 60%). `-B/70%` specifies that less than 30% of the |
Thomas Ackermann | 2de9b71 | 2013-01-21 20:17:53 +0100 | [diff] [blame] | 561 | original should remain in the result for Git to consider it a total |
Matthieu Moy | cf958af | 2010-08-05 18:14:25 +0200 | [diff] [blame] | 562 | rewrite (i.e. otherwise the resulting patch will be a series of |
| 563 | deletion and insertion mixed together with context lines). |
| 564 | + |
| 565 | When used with -M, a totally-rewritten file is also considered as the |
| 566 | source of a rename (usually -M only considers a file that disappeared |
| 567 | as the source of a rename), and the number `n` controls this aspect of |
| 568 | the -B option (defaults to 50%). `-B20%` specifies that a change with |
| 569 | addition and deletion compared to 20% or more of the file's size are |
| 570 | eligible for being picked up as a possible source of a rename to |
| 571 | another file. |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 572 | |
Matthieu Moy | cf958af | 2010-08-05 18:14:25 +0200 | [diff] [blame] | 573 | -M[<n>]:: |
Yann Dirson | f611ddc | 2010-11-10 21:27:12 +0100 | [diff] [blame] | 574 | --find-renames[=<n>]:: |
Jeff King | 7ffad25 | 2010-05-08 00:44:34 -0400 | [diff] [blame] | 575 | ifndef::git-log[] |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 576 | Detect renames. |
Jeff King | 7ffad25 | 2010-05-08 00:44:34 -0400 | [diff] [blame] | 577 | endif::git-log[] |
| 578 | ifdef::git-log[] |
| 579 | If generating diffs, detect and report renames for each commit. |
| 580 | For following files across renames while traversing history, see |
| 581 | `--follow`. |
| 582 | endif::git-log[] |
João Britto | 4c007ae | 2011-05-06 01:16:17 -0300 | [diff] [blame] | 583 | If `n` is specified, it is a threshold on the similarity |
Matthieu Moy | cf958af | 2010-08-05 18:14:25 +0200 | [diff] [blame] | 584 | index (i.e. amount of addition/deletions compared to the |
Thomas Ackermann | 2de9b71 | 2013-01-21 20:17:53 +0100 | [diff] [blame] | 585 | file's size). For example, `-M90%` means Git should consider a |
Matthieu Moy | cf958af | 2010-08-05 18:14:25 +0200 | [diff] [blame] | 586 | delete/add pair to be a rename if more than 90% of the file |
Sitaram Chamarty | 31d66aa | 2012-12-18 16:17:09 +0530 | [diff] [blame] | 587 | hasn't changed. Without a `%` sign, the number is to be read as |
| 588 | a fraction, with a decimal point before it. I.e., `-M5` becomes |
| 589 | 0.5, and is thus the same as `-M50%`. Similarly, `-M05` is |
| 590 | the same as `-M5%`. To limit detection to exact renames, use |
Fraser Tweedale | 8240943 | 2013-07-05 18:42:17 +1000 | [diff] [blame] | 591 | `-M100%`. The default similarity index is 50%. |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 592 | |
Matthieu Moy | cf958af | 2010-08-05 18:14:25 +0200 | [diff] [blame] | 593 | -C[<n>]:: |
Yann Dirson | f611ddc | 2010-11-10 21:27:12 +0100 | [diff] [blame] | 594 | --find-copies[=<n>]:: |
Johannes Schindelin | ca6c097 | 2007-06-11 21:12:19 +0100 | [diff] [blame] | 595 | Detect copies as well as renames. See also `--find-copies-harder`. |
Matthieu Moy | cf958af | 2010-08-05 18:14:25 +0200 | [diff] [blame] | 596 | If `n` is specified, it has the same meaning as for `-M<n>`. |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 597 | |
| 598 | --find-copies-harder:: |
Johannes Schindelin | ca6c097 | 2007-06-11 21:12:19 +0100 | [diff] [blame] | 599 | For performance reasons, by default, `-C` option finds copies only |
Junio C Hamano | a6080a0 | 2007-06-07 00:04:01 -0700 | [diff] [blame] | 600 | if the original file of the copy was modified in the same |
Christian Meder | f73ae1f | 2005-10-05 15:08:26 -0700 | [diff] [blame] | 601 | changeset. This flag makes the command |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 602 | inspect unmodified files as candidates for the source of |
| 603 | copy. This is a very expensive operation for large |
Johannes Schindelin | ca6c097 | 2007-06-11 21:12:19 +0100 | [diff] [blame] | 604 | projects, so use it with caution. Giving more than one |
| 605 | `-C` option has the same effect. |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 606 | |
Junio C Hamano | 467ddc1 | 2011-02-28 16:11:55 -0800 | [diff] [blame] | 607 | -D:: |
| 608 | --irreversible-delete:: |
| 609 | Omit the preimage for deletes, i.e. print only the header but not |
| 610 | the diff between the preimage and `/dev/null`. The resulting patch |
Justin Lebar | a58088a | 2014-03-31 15:11:44 -0700 | [diff] [blame] | 611 | is not meant to be applied with `patch` or `git apply`; this is |
Junio C Hamano | 467ddc1 | 2011-02-28 16:11:55 -0800 | [diff] [blame] | 612 | solely for people who want to just concentrate on reviewing the |
Anthony Sottile | bc9b7e2 | 2017-07-31 07:00:31 -0700 | [diff] [blame] | 613 | text after the change. In addition, the output obviously lacks |
Junio C Hamano | 467ddc1 | 2011-02-28 16:11:55 -0800 | [diff] [blame] | 614 | enough information to apply such a patch in reverse, even manually, |
| 615 | hence the name of the option. |
| 616 | + |
| 617 | When used together with `-B`, omit also the preimage in the deletion part |
| 618 | of a delete/create pair. |
| 619 | |
Junio C Hamano | 8082d8d | 2005-09-21 00:18:27 -0700 | [diff] [blame] | 620 | -l<num>:: |
Elijah Newren | 6623a52 | 2021-07-15 00:45:22 +0000 | [diff] [blame] | 621 | The `-M` and `-C` options involve some preliminary steps that |
| 622 | can detect subsets of renames/copies cheaply, followed by an |
| 623 | exhaustive fallback portion that compares all remaining |
| 624 | unpaired destinations to all relevant sources. (For renames, |
| 625 | only remaining unpaired sources are relevant; for copies, all |
| 626 | original sources are relevant.) For N sources and |
| 627 | destinations, this exhaustive check is O(N^2). This option |
| 628 | prevents the exhaustive portion of rename/copy detection from |
| 629 | running if the number of source/destination files involved |
| 630 | exceeds the specified number. Defaults to diff.renameLimit. |
Elijah Newren | 9dd29db | 2021-07-15 00:45:23 +0000 | [diff] [blame] | 631 | Note that a value of 0 is treated as unlimited. |
Junio C Hamano | 8082d8d | 2005-09-21 00:18:27 -0700 | [diff] [blame] | 632 | |
Björn Gustavsson | d4cb003 | 2009-11-07 10:52:29 +0100 | [diff] [blame] | 633 | ifndef::git-format-patch[] |
Yann Dirson | f103744 | 2010-11-10 21:27:13 +0100 | [diff] [blame] | 634 | --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]:: |
| 635 | Select only files that are Added (`A`), Copied (`C`), |
| 636 | Deleted (`D`), Modified (`M`), Renamed (`R`), have their |
| 637 | type (i.e. regular file, symlink, submodule, ...) changed (`T`), |
| 638 | are Unmerged (`U`), are |
| 639 | Unknown (`X`), or have had their pairing Broken (`B`). |
| 640 | Any combination of the filter characters (including none) can be used. |
| 641 | When `*` (All-or-none) is added to the combination, all |
| 642 | paths are selected if there is any file that matches |
| 643 | other criteria in the comparison; if there is no file |
| 644 | that matches other criteria, nothing is selected. |
Junio C Hamano | 16726cf | 2016-07-14 12:17:47 -0700 | [diff] [blame] | 645 | + |
| 646 | Also, these upper-case letters can be downcased to exclude. E.g. |
| 647 | `--diff-filter=ad` excludes added and deleted paths. |
Jeff King | 46af107 | 2018-01-04 11:49:42 -0500 | [diff] [blame] | 648 | + |
Johannes Schindelin | d843e31 | 2022-01-28 12:02:48 +0000 | [diff] [blame] | 649 | Note that not all diffs can feature all types. For instance, copied and |
| 650 | renamed entries cannot appear if detection for those types is disabled. |
Yann Dirson | f103744 | 2010-11-10 21:27:13 +0100 | [diff] [blame] | 651 | |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 652 | -S<string>:: |
Ramkumar Ramachandra | 5bc3f0b | 2013-05-31 17:42:15 +0530 | [diff] [blame] | 653 | Look for differences that change the number of occurrences of |
| 654 | the specified string (i.e. addition/deletion) in a file. |
| 655 | Intended for the scripter's use. |
| 656 | + |
| 657 | It is useful when you're looking for an exact block of code (like a |
| 658 | struct), and want to know the history of that block since it first |
| 659 | came into being: use the feature iteratively to feed the interesting |
| 660 | block in the preimage back into `-S`, and keep going until you get the |
| 661 | very first version of the block. |
Thomas Braun | e0e7cb8 | 2018-12-14 19:49:12 +0100 | [diff] [blame] | 662 | + |
| 663 | Binary files are searched as well. |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 664 | |
Junio C Hamano | f506b8e | 2010-08-23 10:17:03 -0700 | [diff] [blame] | 665 | -G<regex>:: |
Ramkumar Ramachandra | 5bc3f0b | 2013-05-31 17:42:15 +0530 | [diff] [blame] | 666 | Look for differences whose patch text contains added/removed |
| 667 | lines that match <regex>. |
| 668 | + |
| 669 | To illustrate the difference between `-S<regex> --pickaxe-regex` and |
| 670 | `-G<regex>`, consider a commit with the following diff in the same |
| 671 | file: |
| 672 | + |
| 673 | ---- |
Martin Ågren | 9299f84 | 2020-02-06 21:53:01 +0100 | [diff] [blame] | 674 | + return frotz(nitfol, two->ptr, 1, 0); |
Ramkumar Ramachandra | 5bc3f0b | 2013-05-31 17:42:15 +0530 | [diff] [blame] | 675 | ... |
Martin Ågren | 9299f84 | 2020-02-06 21:53:01 +0100 | [diff] [blame] | 676 | - hit = frotz(nitfol, mf2.ptr, 1, 0); |
Ramkumar Ramachandra | 5bc3f0b | 2013-05-31 17:42:15 +0530 | [diff] [blame] | 677 | ---- |
| 678 | + |
Martin Ågren | 9299f84 | 2020-02-06 21:53:01 +0100 | [diff] [blame] | 679 | While `git log -G"frotz\(nitfol"` will show this commit, `git log |
| 680 | -S"frotz\(nitfol" --pickaxe-regex` will not (because the number of |
Ramkumar Ramachandra | 5bc3f0b | 2013-05-31 17:42:15 +0530 | [diff] [blame] | 681 | occurrences of that string did not change). |
| 682 | + |
Thomas Braun | e0e7cb8 | 2018-12-14 19:49:12 +0100 | [diff] [blame] | 683 | Unless `--text` is supplied patches of binary files without a textconv |
| 684 | filter will be ignored. |
| 685 | + |
Ramkumar Ramachandra | 5bc3f0b | 2013-05-31 17:42:15 +0530 | [diff] [blame] | 686 | See the 'pickaxe' entry in linkgit:gitdiffcore[7] for more |
| 687 | information. |
Junio C Hamano | f506b8e | 2010-08-23 10:17:03 -0700 | [diff] [blame] | 688 | |
Stefan Beller | 15af58c | 2018-01-04 14:50:42 -0800 | [diff] [blame] | 689 | --find-object=<object-id>:: |
| 690 | Look for differences that change the number of occurrences of |
| 691 | the specified object. Similar to `-S`, just the argument is different |
| 692 | in that it doesn't search for a specific string but for a specific |
| 693 | object id. |
| 694 | + |
| 695 | The object can be a blob or a submodule commit. It implies the `-t` option in |
| 696 | `git-log` to also find trees. |
| 697 | |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 698 | --pickaxe-all:: |
Junio C Hamano | f506b8e | 2010-08-23 10:17:03 -0700 | [diff] [blame] | 699 | When `-S` or `-G` finds a change, show all the changes in that |
Christian Meder | f73ae1f | 2005-10-05 15:08:26 -0700 | [diff] [blame] | 700 | changeset, not just the files that contain the change |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 701 | in <string>. |
| 702 | |
Petr Baudis | d01d8c6 | 2006-03-29 02:16:33 +0200 | [diff] [blame] | 703 | --pickaxe-regex:: |
Ramkumar Ramachandra | 5bc3f0b | 2013-05-31 17:42:15 +0530 | [diff] [blame] | 704 | Treat the <string> given to `-S` as an extended POSIX regular |
| 705 | expression to match. |
Stefan Beller | 15af58c | 2018-01-04 14:50:42 -0800 | [diff] [blame] | 706 | |
Björn Gustavsson | d4cb003 | 2009-11-07 10:52:29 +0100 | [diff] [blame] | 707 | endif::git-format-patch[] |
Petr Baudis | d01d8c6 | 2006-03-29 02:16:33 +0200 | [diff] [blame] | 708 | |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 709 | -O<orderfile>:: |
Richard Hansen | 874444b | 2017-01-15 17:16:31 -0500 | [diff] [blame] | 710 | Control the order in which files appear in the output. |
Nguyễn Thái Ngọc Duy | da0005b | 2015-03-11 16:32:45 -0400 | [diff] [blame] | 711 | This overrides the `diff.orderFile` configuration variable |
| 712 | (see linkgit:git-config[1]). To cancel `diff.orderFile`, |
Samuel Bronson | 6d8940b | 2013-12-18 19:08:12 -0500 | [diff] [blame] | 713 | use `-O/dev/null`. |
Richard Hansen | 874444b | 2017-01-15 17:16:31 -0500 | [diff] [blame] | 714 | + |
| 715 | The output order is determined by the order of glob patterns in |
| 716 | <orderfile>. |
| 717 | All files with pathnames that match the first pattern are output |
| 718 | first, all files with pathnames that match the second pattern (but not |
| 719 | the first) are output next, and so on. |
| 720 | All files with pathnames that do not match any pattern are output |
| 721 | last, as if there was an implicit match-all pattern at the end of the |
| 722 | file. |
| 723 | If multiple pathnames have the same rank (they match the same pattern |
| 724 | but no earlier patterns), their output order relative to each other is |
| 725 | the normal order. |
| 726 | + |
| 727 | <orderfile> is parsed as follows: |
| 728 | + |
| 729 | -- |
| 730 | - Blank lines are ignored, so they can be used as separators for |
| 731 | readability. |
| 732 | |
| 733 | - Lines starting with a hash ("`#`") are ignored, so they can be used |
| 734 | for comments. Add a backslash ("`\`") to the beginning of the |
| 735 | pattern if it starts with a hash. |
| 736 | |
| 737 | - Each other line contains a single pattern. |
| 738 | -- |
| 739 | + |
| 740 | Patterns have the same syntax and semantics as patterns used for |
Elijah Newren | c30d4f1 | 2018-04-05 10:20:26 -0700 | [diff] [blame] | 741 | fnmatch(3) without the FNM_PATHNAME flag, except a pathname also |
Richard Hansen | 874444b | 2017-01-15 17:16:31 -0500 | [diff] [blame] | 742 | matches a pattern if removing any number of the final pathname |
| 743 | components matches the pattern. For example, the pattern "`foo*bar`" |
| 744 | matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`". |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 745 | |
Junio C Hamano | 1eb4136 | 2021-02-11 11:57:50 -0800 | [diff] [blame] | 746 | --skip-to=<file>:: |
| 747 | --rotate-to=<file>:: |
| 748 | Discard the files before the named <file> from the output |
| 749 | (i.e. 'skip to'), or move them to the end of the output |
Elijah Newren | cf6cac2 | 2023-10-08 06:45:03 +0000 | [diff] [blame] | 750 | (i.e. 'rotate to'). These options were invented primarily for the use |
Junio C Hamano | 1eb4136 | 2021-02-11 11:57:50 -0800 | [diff] [blame] | 751 | of the `git difftool` command, and may not be very useful |
| 752 | otherwise. |
| 753 | |
Björn Gustavsson | d4cb003 | 2009-11-07 10:52:29 +0100 | [diff] [blame] | 754 | ifndef::git-format-patch[] |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 755 | -R:: |
Lukas_Sandström | 5f3aa19 | 2005-11-11 02:12:27 +0100 | [diff] [blame] | 756 | Swap two inputs; that is, show differences from index or |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 757 | on-disk file to tree contents. |
Laurent Arnoud | c28ded8 | 2020-05-22 12:46:18 +0200 | [diff] [blame] | 758 | endif::git-format-patch[] |
Junio C Hamano | dda2d79 | 2005-07-13 12:52:35 -0700 | [diff] [blame] | 759 | |
Junio C Hamano | c0cb4a0 | 2008-02-13 00:34:39 -0800 | [diff] [blame] | 760 | --relative[=<path>]:: |
Laurent Arnoud | c28ded8 | 2020-05-22 12:46:18 +0200 | [diff] [blame] | 761 | --no-relative:: |
Junio C Hamano | cd676a5 | 2008-02-12 14:26:02 -0800 | [diff] [blame] | 762 | When run from a subdirectory of the project, it can be |
| 763 | told to exclude changes outside the directory and show |
Junio C Hamano | c0cb4a0 | 2008-02-13 00:34:39 -0800 | [diff] [blame] | 764 | pathnames relative to it with this option. When you are |
| 765 | not in a subdirectory (e.g. in a bare repository), you |
| 766 | can name which subdirectory to make the output relative |
| 767 | to by giving a <path> as an argument. |
Laurent Arnoud | c28ded8 | 2020-05-22 12:46:18 +0200 | [diff] [blame] | 768 | `--no-relative` can be used to countermand both `diff.relative` config |
| 769 | option and previous `--relative`. |
Junio C Hamano | cd676a5 | 2008-02-12 14:26:02 -0800 | [diff] [blame] | 770 | |
jidanni@jidanni.org | a9e67c8 | 2008-12-29 15:03:17 +0800 | [diff] [blame] | 771 | -a:: |
Stephan Feder | d507bb1 | 2006-07-07 15:57:09 +0200 | [diff] [blame] | 772 | --text:: |
| 773 | Treat all files as text. |
| 774 | |
Junio C Hamano | e9282f0 | 2017-10-26 15:32:27 +0900 | [diff] [blame] | 775 | --ignore-cr-at-eol:: |
Elijah Newren | c30d4f1 | 2018-04-05 10:20:26 -0700 | [diff] [blame] | 776 | Ignore carriage-return at the end of line when doing a comparison. |
Junio C Hamano | e9282f0 | 2017-10-26 15:32:27 +0900 | [diff] [blame] | 777 | |
Junio C Hamano | a44a0c9 | 2007-02-14 00:41:32 -0800 | [diff] [blame] | 778 | --ignore-space-at-eol:: |
Wincent Colaiuta | 0ac7903 | 2007-12-12 09:12:01 +0100 | [diff] [blame] | 779 | Ignore changes in whitespace at EOL. |
Junio C Hamano | a44a0c9 | 2007-02-14 00:41:32 -0800 | [diff] [blame] | 780 | |
jidanni@jidanni.org | a9e67c8 | 2008-12-29 15:03:17 +0800 | [diff] [blame] | 781 | -b:: |
Jakub Narebski | 8ebe185 | 2006-12-03 17:24:41 +0100 | [diff] [blame] | 782 | --ignore-space-change:: |
Wincent Colaiuta | 0ac7903 | 2007-12-12 09:12:01 +0100 | [diff] [blame] | 783 | Ignore changes in amount of whitespace. This ignores whitespace |
| 784 | at line end, and considers all other sequences of one or |
| 785 | more whitespace characters to be equivalent. |
Jakub Narebski | 8ebe185 | 2006-12-03 17:24:41 +0100 | [diff] [blame] | 786 | |
jidanni@jidanni.org | a9e67c8 | 2008-12-29 15:03:17 +0800 | [diff] [blame] | 787 | -w:: |
Jakub Narebski | 8ebe185 | 2006-12-03 17:24:41 +0100 | [diff] [blame] | 788 | --ignore-all-space:: |
Wincent Colaiuta | 0ac7903 | 2007-12-12 09:12:01 +0100 | [diff] [blame] | 789 | Ignore whitespace when comparing lines. This ignores |
| 790 | differences even if one line has whitespace where the other |
Jakub Narebski | 8ebe185 | 2006-12-03 17:24:41 +0100 | [diff] [blame] | 791 | line has none. |
| 792 | |
Antoine Pelisse | 36617af | 2013-06-19 20:46:07 +0200 | [diff] [blame] | 793 | --ignore-blank-lines:: |
| 794 | Ignore changes whose lines are all blank. |
| 795 | |
Michał Kępień | 296d4a9 | 2020-10-20 08:48:09 +0200 | [diff] [blame] | 796 | -I<regex>:: |
| 797 | --ignore-matching-lines=<regex>:: |
| 798 | Ignore changes whose all lines match <regex>. This option may |
| 799 | be specified more than once. |
| 800 | |
René Scharfe | 6d0e674 | 2008-12-28 19:45:32 +0100 | [diff] [blame] | 801 | --inter-hunk-context=<lines>:: |
| 802 | Show the context between diff hunks, up to the specified number |
| 803 | of lines, thereby fusing hunks that are close to each other. |
Vegard Nossum | c488867 | 2017-01-12 13:21:11 +0100 | [diff] [blame] | 804 | Defaults to `diff.interHunkContext` or 0 if the config option |
| 805 | is unset. |
René Scharfe | 6d0e674 | 2008-12-28 19:45:32 +0100 | [diff] [blame] | 806 | |
René Scharfe | 14937c2 | 2011-10-09 13:36:57 +0200 | [diff] [blame] | 807 | -W:: |
| 808 | --function-context:: |
Philippe Blain | 0cce88f | 2020-11-01 17:28:43 +0000 | [diff] [blame] | 809 | Show whole function as context lines for each change. |
| 810 | The function names are determined in the same way as |
| 811 | `git diff` works out patch hunk headers (see 'Defining a |
| 812 | custom hunk-header' in linkgit:gitattributes[5]). |
René Scharfe | 14937c2 | 2011-10-09 13:36:57 +0200 | [diff] [blame] | 813 | |
Björn Gustavsson | d4cb003 | 2009-11-07 10:52:29 +0100 | [diff] [blame] | 814 | ifndef::git-format-patch[] |
Jeff King | 939ca96 | 2011-11-08 16:29:30 -0500 | [diff] [blame] | 815 | ifndef::git-log[] |
Alex Riesen | 41bbf9d | 2007-03-14 01:17:04 +0100 | [diff] [blame] | 816 | --exit-code:: |
| 817 | Make the program exit with codes similar to diff(1). |
| 818 | That is, it exits with 1 if there were differences and |
| 819 | 0 means no differences. |
| 820 | |
Alex Riesen | 2a18c26 | 2007-03-25 01:55:43 +0100 | [diff] [blame] | 821 | --quiet:: |
Björn Gustavsson | dce5ef1 | 2009-11-07 10:53:07 +0100 | [diff] [blame] | 822 | Disable all output of the program. Implies `--exit-code`. |
René Scharfe | d7b97b7 | 2024-06-09 09:41:44 +0200 | [diff] [blame] | 823 | Disables execution of external diff helpers whose exit code |
| 824 | is not trusted, i.e. their respective configuration option |
| 825 | `diff.trustExitCode` or `diff.<driver>.trustExitCode` or |
| 826 | environment variable `GIT_EXTERNAL_DIFF_TRUST_EXIT_CODE` is |
| 827 | false. |
Jeff King | 939ca96 | 2011-11-08 16:29:30 -0500 | [diff] [blame] | 828 | endif::git-log[] |
Björn Gustavsson | d4cb003 | 2009-11-07 10:52:29 +0100 | [diff] [blame] | 829 | endif::git-format-patch[] |
Alex Riesen | 2a18c26 | 2007-03-25 01:55:43 +0100 | [diff] [blame] | 830 | |
Johannes Schindelin | 72909be | 2007-06-30 18:47:07 +0100 | [diff] [blame] | 831 | --ext-diff:: |
| 832 | Allow an external diff helper to be executed. If you set an |
Dan McGee | 5162e69 | 2007-12-29 00:20:38 -0600 | [diff] [blame] | 833 | external diff driver with linkgit:gitattributes[5], you need |
| 834 | to use this option with linkgit:git-log[1] and friends. |
Johannes Schindelin | 72909be | 2007-06-30 18:47:07 +0100 | [diff] [blame] | 835 | |
| 836 | --no-ext-diff:: |
| 837 | Disallow external diff drivers. |
| 838 | |
Jeff King | d28790d | 2011-07-06 11:13:30 -0400 | [diff] [blame] | 839 | --textconv:: |
| 840 | --no-textconv:: |
| 841 | Allow (or disallow) external text conversion filters to be run |
| 842 | when comparing binary files. See linkgit:gitattributes[5] for |
| 843 | details. Because textconv filters are typically a one-way |
| 844 | conversion, the resulting diff is suitable for human |
| 845 | consumption, but cannot be applied. For this reason, textconv |
| 846 | filters are enabled by default only for linkgit:git-diff[1] and |
| 847 | linkgit:git-log[1], but not for linkgit:git-format-patch[1] or |
| 848 | diff plumbing commands. |
| 849 | |
Jens Lehmann | dd44d41 | 2010-06-08 18:31:51 +0200 | [diff] [blame] | 850 | --ignore-submodules[=<when>]:: |
| 851 | Ignore changes to submodules in the diff generation. <when> can be |
Phil Hord | b1d04bf | 2013-05-28 19:36:44 +0000 | [diff] [blame] | 852 | either "none", "untracked", "dirty" or "all", which is the default. |
Jens Lehmann | aee9c7d | 2010-08-06 00:39:25 +0200 | [diff] [blame] | 853 | Using "none" will consider the submodule modified when it either contains |
| 854 | untracked or modified files or its HEAD differs from the commit recorded |
| 855 | in the superproject and can be used to override any settings of the |
Jens Lehmann | 302ad7a | 2010-08-06 00:40:48 +0200 | [diff] [blame] | 856 | 'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When |
Jens Lehmann | dd44d41 | 2010-06-08 18:31:51 +0200 | [diff] [blame] | 857 | "untracked" is used submodules are not considered dirty when they only |
| 858 | contain untracked content (but they are still scanned for modified |
| 859 | content). Using "dirty" ignores all changes to the work tree of submodules, |
| 860 | only changes to the commits stored in the superproject are shown (this was |
| 861 | the behavior until 1.7.0). Using "all" hides all changes to submodules. |
Johannes Schindelin | 50fd9bd | 2008-05-14 18:03:31 +0100 | [diff] [blame] | 862 | |
Johannes Schindelin | eab9a40 | 2007-12-18 19:32:14 +0000 | [diff] [blame] | 863 | --src-prefix=<prefix>:: |
| 864 | Show the given source prefix instead of "a/". |
| 865 | |
| 866 | --dst-prefix=<prefix>:: |
| 867 | Show the given destination prefix instead of "b/". |
| 868 | |
| 869 | --no-prefix:: |
| 870 | Do not show any source or destination prefix. |
| 871 | |
Jeff King | b39a569 | 2023-03-09 01:09:54 -0500 | [diff] [blame] | 872 | --default-prefix:: |
| 873 | Use the default source and destination prefixes ("a/" and "b/"). |
Peter Hutterer | 7fdc265 | 2024-03-15 11:03:10 +1000 | [diff] [blame] | 874 | This overrides configuration variables such as `diff.noprefix`, |
| 875 | `diff.srcPrefix`, `diff.dstPrefix`, and `diff.mnemonicPrefix` |
| 876 | (see `git-config`(1)). |
Jeff King | b39a569 | 2023-03-09 01:09:54 -0500 | [diff] [blame] | 877 | |
Jacob Keller | 660e113 | 2016-08-31 16:27:20 -0700 | [diff] [blame] | 878 | --line-prefix=<prefix>:: |
| 879 | Prepend an additional prefix to every line of output. |
| 880 | |
Nguyễn Thái Ngọc Duy | b42b451 | 2016-10-24 17:42:20 +0700 | [diff] [blame] | 881 | --ita-invisible-in-index:: |
| 882 | By default entries added by "git add -N" appear as an existing |
| 883 | empty file in "git diff" and a new file in "git diff --cached". |
| 884 | This option makes the entry appear as a new file in "git diff" |
| 885 | and non-existent in "git diff --cached". This option could be |
| 886 | reverted with `--ita-visible-in-index`. Both options are |
| 887 | experimental and could be removed in future. |
| 888 | |
Junio C Hamano | 8db9307 | 2005-08-30 13:51:01 -0700 | [diff] [blame] | 889 | For more detailed explanation on these common options, see also |
Jonathan Nieder | 6998e4d | 2008-06-30 17:01:21 -0500 | [diff] [blame] | 890 | linkgit:gitdiffcore[7]. |