blob: faa467b03297fa61584a6a75745e3fe1b78c8e21 [file] [log] [blame]
Sergei Organovc1a95fa2007-11-15 16:19:29 +03001// 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
7ifndef::git-format-patch[]
8ifndef::git-diff[]
Miklos Vajna272bd3c2007-11-01 15:57:40 +01009ifndef::git-log[]
Sergei Organovc1a95fa2007-11-15 16:19:29 +030010:git-diff-core: 1
Miklos Vajna272bd3c2007-11-01 15:57:40 +010011endif::git-log[]
Sergei Organovc1a95fa2007-11-15 16:19:29 +030012endif::git-diff[]
13endif::git-format-patch[]
14
15ifdef::git-format-patch[]
Junio C Hamanodda2d792005-07-13 12:52:35 -070016-p::
Björn Gustavsson2cfa8332009-11-07 10:58:55 +010017--no-stat::
Björn Gustavsson02bc5b02009-11-07 10:51:56 +010018 Generate plain patches without any diffstats.
Sergei Organovc1a95fa2007-11-15 16:19:29 +030019endif::git-format-patch[]
20
21ifndef::git-format-patch[]
22-p::
jidanni@jidanni.orga9e67c82008-12-29 15:03:17 +080023-u::
Will Palmer1c9eecf2010-05-13 09:59:00 +010024--patch::
Sergei Organovc1a95fa2007-11-15 16:19:29 +030025 Generate patch (see section on generating patches).
26 {git-diff? This is the default.}
27endif::git-format-patch[]
Junio C Hamanodda2d792005-07-13 12:52:35 -070028
Robin Rosenberg4eb99472007-07-25 12:08:17 +020029-U<n>::
Robin Rosenberg4eb99472007-07-25 12:08:17 +020030--unified=<n>::
31 Generate diffs with <n> lines of context instead of
Björn Gustavsson02bc5b02009-11-07 10:51:56 +010032 the usual three.
33ifndef::git-format-patch[]
Björn Gustavssondce5ef12009-11-07 10:53:07 +010034 Implies `-p`.
Björn Gustavsson02bc5b02009-11-07 10:51:56 +010035endif::git-format-patch[]
Robin Rosenberg4eb99472007-07-25 12:08:17 +020036
Björn Gustavssond4cb0032009-11-07 10:52:29 +010037ifndef::git-format-patch[]
Junio C Hamanob5376642006-07-07 05:28:05 -070038--raw::
39 Generate the raw format.
Sergei Organovc1a95fa2007-11-15 16:19:29 +030040 {git-diff-core? This is the default.}
Björn Gustavssond4cb0032009-11-07 10:52:29 +010041endif::git-format-patch[]
Junio C Hamanob5376642006-07-07 05:28:05 -070042
Björn Gustavsson02bc5b02009-11-07 10:51:56 +010043ifndef::git-format-patch[]
Petr Baudis5c91da22006-04-11 13:22:17 +020044--patch-with-raw::
Björn Gustavssondce5ef12009-11-07 10:53:07 +010045 Synonym for `-p --raw`.
Björn Gustavsson02bc5b02009-11-07 10:51:56 +010046endif::git-format-patch[]
Petr Baudis5c91da22006-04-11 13:22:17 +020047
Teemu Likonenec740422009-01-25 14:20:22 +020048--patience::
Johannes Schindelin34292bd2009-01-01 17:39:17 +010049 Generate a diff using the "patience diff" algorithm.
50
Linus Torvalds5c5b2ea2006-09-28 15:07:16 -070051--stat[=width[,name-width]]::
52 Generate a diffstat. You can override the default
Björn Gustavssondce5ef12009-11-07 10:53:07 +010053 output width for 80-column terminal by `--stat=width`.
Linus Torvalds5c5b2ea2006-09-28 15:07:16 -070054 The width of the filename part can be controlled by
55 giving another width to it separated by a comma.
Johannes Schindelind75f7952006-04-14 00:15:30 +020056
Junio C Hamano74e2abe2006-10-12 03:01:00 -070057--numstat::
Björn Gustavssondce5ef12009-11-07 10:53:07 +010058 Similar to `\--stat`, but shows number of added and
Junio C Hamano74e2abe2006-10-12 03:01:00 -070059 deleted lines in decimal notation and pathname without
Junio C Hamano2f895432006-12-26 00:15:26 -080060 abbreviation, to make it more machine friendly. For
61 binary files, outputs two `-` instead of saying
62 `0 0`.
Junio C Hamano74e2abe2006-10-12 03:01:00 -070063
Nicolas Pitreebd124c2006-12-14 23:15:44 -050064--shortstat::
Björn Gustavssondce5ef12009-11-07 10:53:07 +010065 Output only the last line of the `--stat` format containing total
Nicolas Pitreebd124c2006-12-14 23:15:44 -050066 number of modified files, as well as number of added and deleted
67 lines.
68
Gerrit Pape37152d82008-04-21 18:15:52 +000069--dirstat[=limit]::
Heikki Orsila62e00b02008-09-01 03:50:28 +030070 Output the distribution of relative amount of changes (number of lines added or
71 removed) for each sub-directory. Directories with changes below
72 a cut-off percent (3% by default) are not shown. The cut-off percent
Björn Gustavssondce5ef12009-11-07 10:53:07 +010073 can be set with `--dirstat=limit`. Changes in a child directory is not
74 counted for the parent directory, unless `--cumulative` is used.
Gerrit Pape37152d82008-04-21 18:15:52 +000075
Heikki Orsilafd337772008-09-05 22:27:35 +030076--dirstat-by-file[=limit]::
Björn Gustavssondce5ef12009-11-07 10:53:07 +010077 Same as `--dirstat`, but counts changed files instead of lines.
Heikki Orsilafd337772008-09-05 22:27:35 +030078
Sean4bbd2612006-05-14 08:13:49 -040079--summary::
80 Output a condensed summary of extended header information
81 such as creations, renames and mode changes.
82
Björn Gustavsson02bc5b02009-11-07 10:51:56 +010083ifndef::git-format-patch[]
Johannes Schindelin29353272006-04-15 13:41:18 +020084--patch-with-stat::
Björn Gustavssondce5ef12009-11-07 10:53:07 +010085 Synonym for `-p --stat`.
Björn Gustavsson02bc5b02009-11-07 10:51:56 +010086endif::git-format-patch[]
Johannes Schindelin29353272006-04-15 13:41:18 +020087
Björn Gustavssond4cb0032009-11-07 10:52:29 +010088ifndef::git-format-patch[]
Björn Gustavsson64485b42009-11-22 20:43:20 +010089
Junio C Hamanodda2d792005-07-13 12:52:35 -070090-z::
Björn Gustavsson5c931c82009-11-23 08:40:24 +010091ifdef::git-log[]
92 Separate the commits with NULs instead of with new newlines.
93+
94Also, when `--raw` or `--numstat` has been given, do not munge
95pathnames and use NULs as output field terminators.
96endif::git-log[]
Björn Gustavsson64485b42009-11-22 20:43:20 +010097ifndef::git-log[]
Charles Bailey03aa87e2010-04-18 19:28:17 +010098 When `--raw`, `--numstat`, `--name-only` or `--name-status` has been
99 given, do not munge pathnames and use NULs as output field terminators.
Björn Gustavsson5c931c82009-11-23 08:40:24 +0100100endif::git-log[]
Björn Gustavsson64485b42009-11-22 20:43:20 +0100101+
102Without this option, each pathname output will have TAB, LF, double quotes,
103and backslash characters replaced with `\t`, `\n`, `\"`, and `\\`,
104respectively, and the pathname will be enclosed in double quotes if
105any of those replacements occurred.
Junio C Hamanodda2d792005-07-13 12:52:35 -0700106
107--name-only::
108 Show only names of changed files.
109
Junio C Hamano946f5f72005-09-21 00:20:06 -0700110--name-status::
Miklos Vajnaa6f47b22008-04-22 14:23:48 +0200111 Show only names and status of changed files. See the description
112 of the `--diff-filter` option on what the status letters mean.
Junio C Hamanodda2d792005-07-13 12:52:35 -0700113
Johannes Schindelin752c0c22009-10-19 14:38:32 +0200114--submodule[=<format>]::
115 Chose the output format for submodule differences. <format> can be one of
116 'short' and 'log'. 'short' just shows pairs of commit names, this format
117 is used when this option is not given. 'log' is the default value for this
118 option and lists the commits in that commit range like the 'summary'
119 option of linkgit:git-submodule[1] does.
120
Mark Lodato73e9da02010-02-16 23:55:58 -0500121--color[=<when>]::
Junio C Hamanob5376642006-07-07 05:28:05 -0700122 Show colored diff.
Mark Lodato73e9da02010-02-16 23:55:58 -0500123 The value must be always (the default), never, or auto.
Junio C Hamanob5376642006-07-07 05:28:05 -0700124
125--no-color::
126 Turn off colored diff, even when the configuration file
127 gives the default to color output.
Mark Lodato73e9da02010-02-16 23:55:58 -0500128 Same as `--color=never`.
Junio C Hamanob5376642006-07-07 05:28:05 -0700129
Thomas Rast882749a2010-04-14 17:59:06 +0200130--word-diff[=<mode>]::
131 Show a word diff, using the <mode> to delimit changed words.
132 By default, words are delimited by whitespace; see
133 `--word-diff-regex` below. The <mode> defaults to 'plain', and
134 must be one of:
Johannes Schindelin2b6a5412009-01-17 17:29:45 +0100135+
Thomas Rast882749a2010-04-14 17:59:06 +0200136--
137color::
138 Highlight changed words using only colors. Implies `--color`.
139plain::
140 Show words as `[-removed-]` and `{+added+}`. Makes no
141 attempts to escape the delimiters if they appear in the input,
142 so the output may be ambiguous.
143porcelain::
144 Use a special line-based format intended for script
145 consumption. Added/removed/unchanged runs are printed in the
146 usual unified diff format, starting with a `+`/`-`/` `
147 character at the beginning of the line and extending to the
148 end of the line. Newlines in the input are represented by a
149 tilde `~` on a line of its own.
150none::
151 Disable word diff again.
152--
153+
154Note that despite the name of the first mode, color is used to
155highlight the changed parts in all modes if enabled.
156
157--word-diff-regex=<regex>::
158 Use <regex> to decide what a word is, instead of considering
159 runs of non-whitespace to be a word. Also implies
160 `--word-diff` unless it was already enabled.
161+
162Every non-overlapping match of the
Thomas Rastc4b252c2009-01-17 17:29:47 +0100163<regex> is considered a word. Anything between these matches is
164considered whitespace and ignored(!) for the purposes of finding
165differences. You may want to append `|[^[:space:]]` to your regular
166expression to make sure that it matches all non-whitespace characters.
167A match that contains a newline is silently truncated(!) at the
168newline.
Thomas Rast80c49c32009-01-17 17:29:48 +0100169+
Boyd Stephen Smith Jr98a4d872009-01-20 21:46:57 -0600170The regex can also be set via a diff driver or configuration option, see
171linkgit:gitattributes[1] or linkgit:git-config[1]. Giving it explicitly
172overrides any diff driver or configuration setting. Diff drivers
173override configuration settings.
Thomas Rast882749a2010-04-14 17:59:06 +0200174
175--color-words[=<regex>]::
176 Equivalent to `--word-diff=color` plus (if a regex was
177 specified) `--word-diff-regex=<regex>`.
Björn Gustavssond4cb0032009-11-07 10:52:29 +0100178endif::git-format-patch[]
Johannes Schindelinf59a59e2006-07-28 23:56:15 +0200179
Junio C Hamanob5376642006-07-07 05:28:05 -0700180--no-renames::
181 Turn off rename detection, even when the configuration
182 file gives the default to do so.
183
Björn Gustavsson02bc5b02009-11-07 10:51:56 +0100184ifndef::git-format-patch[]
Bill Lear16507fc2007-01-27 07:21:53 -0600185--check::
186 Warn if changes introduce trailing whitespace
Wincent Colaiuta62c64892007-12-13 21:24:52 +0100187 or an indent that uses a space before a tab. Exits with
188 non-zero status if problems are found. Not compatible with
189 --exit-code.
Björn Gustavsson02bc5b02009-11-07 10:51:56 +0100190endif::git-format-patch[]
Bill Lear16507fc2007-01-27 07:21:53 -0600191
Junio C Hamano80b1e512005-11-14 17:53:22 -0800192--full-index::
Jim Meyering6457e582008-07-02 09:49:59 +0200193 Instead of the first handful of characters, show the full
194 pre- and post-image blob object names on the "index"
195 line when generating patch format output.
Junio C Hamanob5376642006-07-07 05:28:05 -0700196
197--binary::
Björn Gustavssondce5ef12009-11-07 10:53:07 +0100198 In addition to `--full-index`, output a binary diff that
199 can be applied with `git-apply`.
Junio C Hamano80b1e512005-11-14 17:53:22 -0800200
Junio C Hamano913419f2005-12-18 02:03:15 -0800201--abbrev[=<n>]::
Junio C Hamano47dd0d52005-12-13 17:21:41 -0800202 Instead of showing the full 40-byte hexadecimal object
203 name in diff-raw format output and diff-tree header
Jon Loeliger323b9db2009-01-12 14:02:07 -0600204 lines, show only a partial prefix. This is
Björn Gustavssondce5ef12009-11-07 10:53:07 +0100205 independent of the `--full-index` option above, which controls
Junio C Hamano913419f2005-12-18 02:03:15 -0800206 the diff-patch output format. Non default number of
Björn Gustavssondce5ef12009-11-07 10:53:07 +0100207 digits can be specified with `--abbrev=<n>`.
Junio C Hamano47dd0d52005-12-13 17:21:41 -0800208
Junio C Hamanodda2d792005-07-13 12:52:35 -0700209-B::
210 Break complete rewrite changes into pairs of delete and create.
211
212-M::
Jeff King7ffad252010-05-08 00:44:34 -0400213ifndef::git-log[]
Junio C Hamanodda2d792005-07-13 12:52:35 -0700214 Detect renames.
Jeff King7ffad252010-05-08 00:44:34 -0400215endif::git-log[]
216ifdef::git-log[]
217 If generating diffs, detect and report renames for each commit.
218 For following files across renames while traversing history, see
219 `--follow`.
220endif::git-log[]
Junio C Hamanodda2d792005-07-13 12:52:35 -0700221
222-C::
Johannes Schindelinca6c0972007-06-11 21:12:19 +0100223 Detect copies as well as renames. See also `--find-copies-harder`.
Junio C Hamanodda2d792005-07-13 12:52:35 -0700224
Björn Gustavssond4cb0032009-11-07 10:52:29 +0100225ifndef::git-format-patch[]
Jon Loeliger147cf312006-02-09 09:12:11 -0600226--diff-filter=[ACDMRTUXB*]::
227 Select only files that are Added (`A`), Copied (`C`),
228 Deleted (`D`), Modified (`M`), Renamed (`R`), have their
Junio C Hamanof07c3c52008-10-18 08:20:51 -0700229 type (i.e. regular file, symlink, submodule, ...) changed (`T`),
230 are Unmerged (`U`), are
Jon Loeliger147cf312006-02-09 09:12:11 -0600231 Unknown (`X`), or have had their pairing Broken (`B`).
232 Any combination of the filter characters may be used.
233 When `*` (All-or-none) is added to the combination, all
234 paths are selected if there is any file that matches
235 other criteria in the comparison; if there is no file
236 that matches other criteria, nothing is selected.
Björn Gustavssond4cb0032009-11-07 10:52:29 +0100237endif::git-format-patch[]
Jon Loeliger147cf312006-02-09 09:12:11 -0600238
Junio C Hamanodda2d792005-07-13 12:52:35 -0700239--find-copies-harder::
Johannes Schindelinca6c0972007-06-11 21:12:19 +0100240 For performance reasons, by default, `-C` option finds copies only
Junio C Hamanoa6080a02007-06-07 00:04:01 -0700241 if the original file of the copy was modified in the same
Christian Mederf73ae1f2005-10-05 15:08:26 -0700242 changeset. This flag makes the command
Junio C Hamanodda2d792005-07-13 12:52:35 -0700243 inspect unmodified files as candidates for the source of
244 copy. This is a very expensive operation for large
Johannes Schindelinca6c0972007-06-11 21:12:19 +0100245 projects, so use it with caution. Giving more than one
246 `-C` option has the same effect.
Junio C Hamanodda2d792005-07-13 12:52:35 -0700247
Junio C Hamano8082d8d2005-09-21 00:18:27 -0700248-l<num>::
Björn Gustavssondce5ef12009-11-07 10:53:07 +0100249 The `-M` and `-C` options require O(n^2) processing time where n
Christian Mederf73ae1f2005-10-05 15:08:26 -0700250 is the number of potential rename/copy targets. This
Junio C Hamano8082d8d2005-09-21 00:18:27 -0700251 option prevents rename/copy detection from running if
Christian Mederf73ae1f2005-10-05 15:08:26 -0700252 the number of rename/copy targets exceeds the specified
Junio C Hamano8082d8d2005-09-21 00:18:27 -0700253 number.
254
Björn Gustavssond4cb0032009-11-07 10:52:29 +0100255ifndef::git-format-patch[]
Junio C Hamanodda2d792005-07-13 12:52:35 -0700256-S<string>::
Jeff King821d56a2009-03-03 10:40:41 -0500257 Look for differences that introduce or remove an instance of
258 <string>. Note that this is different than the string simply
259 appearing in diff output; see the 'pickaxe' entry in
260 linkgit:gitdiffcore[7] for more details.
Junio C Hamanodda2d792005-07-13 12:52:35 -0700261
262--pickaxe-all::
Björn Gustavssondce5ef12009-11-07 10:53:07 +0100263 When `-S` finds a change, show all the changes in that
Christian Mederf73ae1f2005-10-05 15:08:26 -0700264 changeset, not just the files that contain the change
Junio C Hamanodda2d792005-07-13 12:52:35 -0700265 in <string>.
266
Petr Baudisd01d8c62006-03-29 02:16:33 +0200267--pickaxe-regex::
268 Make the <string> not a plain string but an extended POSIX
269 regex to match.
Björn Gustavssond4cb0032009-11-07 10:52:29 +0100270endif::git-format-patch[]
Petr Baudisd01d8c62006-03-29 02:16:33 +0200271
Junio C Hamanodda2d792005-07-13 12:52:35 -0700272-O<orderfile>::
273 Output the patch in the order specified in the
274 <orderfile>, which has one shell glob pattern per line.
275
Björn Gustavssond4cb0032009-11-07 10:52:29 +0100276ifndef::git-format-patch[]
Junio C Hamanodda2d792005-07-13 12:52:35 -0700277-R::
Lukas_Sandström5f3aa192005-11-11 02:12:27 +0100278 Swap two inputs; that is, show differences from index or
Junio C Hamanodda2d792005-07-13 12:52:35 -0700279 on-disk file to tree contents.
280
Junio C Hamanoc0cb4a02008-02-13 00:34:39 -0800281--relative[=<path>]::
Junio C Hamanocd676a52008-02-12 14:26:02 -0800282 When run from a subdirectory of the project, it can be
283 told to exclude changes outside the directory and show
Junio C Hamanoc0cb4a02008-02-13 00:34:39 -0800284 pathnames relative to it with this option. When you are
285 not in a subdirectory (e.g. in a bare repository), you
286 can name which subdirectory to make the output relative
287 to by giving a <path> as an argument.
Björn Gustavssond4cb0032009-11-07 10:52:29 +0100288endif::git-format-patch[]
Junio C Hamanocd676a52008-02-12 14:26:02 -0800289
jidanni@jidanni.orga9e67c82008-12-29 15:03:17 +0800290-a::
Stephan Federd507bb12006-07-07 15:57:09 +0200291--text::
292 Treat all files as text.
293
Junio C Hamanoa44a0c92007-02-14 00:41:32 -0800294--ignore-space-at-eol::
Wincent Colaiuta0ac79032007-12-12 09:12:01 +0100295 Ignore changes in whitespace at EOL.
Junio C Hamanoa44a0c92007-02-14 00:41:32 -0800296
jidanni@jidanni.orga9e67c82008-12-29 15:03:17 +0800297-b::
Jakub Narebski8ebe1852006-12-03 17:24:41 +0100298--ignore-space-change::
Wincent Colaiuta0ac79032007-12-12 09:12:01 +0100299 Ignore changes in amount of whitespace. This ignores whitespace
300 at line end, and considers all other sequences of one or
301 more whitespace characters to be equivalent.
Jakub Narebski8ebe1852006-12-03 17:24:41 +0100302
jidanni@jidanni.orga9e67c82008-12-29 15:03:17 +0800303-w::
Jakub Narebski8ebe1852006-12-03 17:24:41 +0100304--ignore-all-space::
Wincent Colaiuta0ac79032007-12-12 09:12:01 +0100305 Ignore whitespace when comparing lines. This ignores
306 differences even if one line has whitespace where the other
Jakub Narebski8ebe1852006-12-03 17:24:41 +0100307 line has none.
308
René Scharfe6d0e6742008-12-28 19:45:32 +0100309--inter-hunk-context=<lines>::
310 Show the context between diff hunks, up to the specified number
311 of lines, thereby fusing hunks that are close to each other.
312
Björn Gustavssond4cb0032009-11-07 10:52:29 +0100313ifndef::git-format-patch[]
Alex Riesen41bbf9d2007-03-14 01:17:04 +0100314--exit-code::
315 Make the program exit with codes similar to diff(1).
316 That is, it exits with 1 if there were differences and
317 0 means no differences.
318
Alex Riesen2a18c262007-03-25 01:55:43 +0100319--quiet::
Björn Gustavssondce5ef12009-11-07 10:53:07 +0100320 Disable all output of the program. Implies `--exit-code`.
Björn Gustavssond4cb0032009-11-07 10:52:29 +0100321endif::git-format-patch[]
Alex Riesen2a18c262007-03-25 01:55:43 +0100322
Johannes Schindelin72909be2007-06-30 18:47:07 +0100323--ext-diff::
324 Allow an external diff helper to be executed. If you set an
Dan McGee5162e692007-12-29 00:20:38 -0600325 external diff driver with linkgit:gitattributes[5], you need
326 to use this option with linkgit:git-log[1] and friends.
Johannes Schindelin72909be2007-06-30 18:47:07 +0100327
328--no-ext-diff::
329 Disallow external diff drivers.
330
Jens Lehmanndd44d412010-06-08 18:31:51 +0200331--ignore-submodules[=<when>]::
332 Ignore changes to submodules in the diff generation. <when> can be
Jens Lehmannaee9c7d2010-08-06 00:39:25 +0200333 either "none", "untracked", "dirty" or "all", which is the default
334 Using "none" will consider the submodule modified when it either contains
335 untracked or modified files or its HEAD differs from the commit recorded
336 in the superproject and can be used to override any settings of the
Jens Lehmann302ad7a2010-08-06 00:40:48 +0200337 'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When
Jens Lehmanndd44d412010-06-08 18:31:51 +0200338 "untracked" is used submodules are not considered dirty when they only
339 contain untracked content (but they are still scanned for modified
340 content). Using "dirty" ignores all changes to the work tree of submodules,
341 only changes to the commits stored in the superproject are shown (this was
342 the behavior until 1.7.0). Using "all" hides all changes to submodules.
Johannes Schindelin50fd9bd2008-05-14 18:03:31 +0100343
Johannes Schindelineab9a402007-12-18 19:32:14 +0000344--src-prefix=<prefix>::
345 Show the given source prefix instead of "a/".
346
347--dst-prefix=<prefix>::
348 Show the given destination prefix instead of "b/".
349
350--no-prefix::
351 Do not show any source or destination prefix.
352
Junio C Hamano8db93072005-08-30 13:51:01 -0700353For more detailed explanation on these common options, see also
Jonathan Nieder6998e4d2008-06-30 17:01:21 -0500354linkgit:gitdiffcore[7].