blob: c93124be79809e36d9a29fd69ce77cd7f22413e1 [file] [log] [blame]
Junio C Hamanoff979792007-11-16 10:11:301// 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[]
Junio C Hamano00b8b632007-12-07 09:50:499ifndef::git-log[]
Junio C Hamanoff979792007-11-16 10:11:3010:git-diff-core: 1
Junio C Hamano00b8b632007-12-07 09:50:4911endif::git-log[]
Junio C Hamanoff979792007-11-16 10:11:3012endif::git-diff[]
13endif::git-format-patch[]
14
15ifdef::git-format-patch[]
Junio C Hamano1a4e8412005-12-27 08:17:2316-p::
Junio C Hamano3b70d3c2009-11-21 17:37:3717--no-stat::
18Generate plain patches without any diffstats.
Junio C Hamanoff979792007-11-16 10:11:3019endif::git-format-patch[]
20
21ifndef::git-format-patch[]
22-p::
Junio C Hamanobbbb8652008-12-29 10:34:2223-u::
Junio C Hamanoe97d5772010-05-19 08:13:5824--patch::
Junio C Hamanoff979792007-11-16 10:11:3025Generate patch (see section on generating patches).
26{git-diff? This is the default.}
27endif::git-format-patch[]
Junio C Hamano1a4e8412005-12-27 08:17:2328
Junio C Hamano69361562007-07-26 02:14:3429-U<n>::
Junio C Hamano69361562007-07-26 02:14:3430--unified=<n>::
31Generate diffs with <n> lines of context instead of
Junio C Hamano3b70d3c2009-11-21 17:37:3732the usual three.
33ifndef::git-format-patch[]
34Implies `-p`.
35endif::git-format-patch[]
Junio C Hamano69361562007-07-26 02:14:3436
Junio C Hamano3b70d3c2009-11-21 17:37:3737ifndef::git-format-patch[]
Junio C Hamano9ae1a062006-07-10 08:12:3438--raw::
39Generate the raw format.
Junio C Hamanoff979792007-11-16 10:11:3040{git-diff-core? This is the default.}
Junio C Hamano3b70d3c2009-11-21 17:37:3741endif::git-format-patch[]
Junio C Hamano9ae1a062006-07-10 08:12:3442
Junio C Hamano3b70d3c2009-11-21 17:37:3743ifndef::git-format-patch[]
Junio C Hamano54559c82006-04-13 07:45:1244--patch-with-raw::
Junio C Hamano3b70d3c2009-11-21 17:37:3745Synonym for `-p --raw`.
46endif::git-format-patch[]
Junio C Hamano54559c82006-04-13 07:45:1247
Junio C Hamano20d47e32009-01-26 06:36:0248--patience::
Junio C Hamano22bcc112009-01-24 08:05:1849Generate a diff using the "patience diff" algorithm.
50
Junio C Hamanod2179ef2010-10-22 04:12:1751--stat[=<width>[,<name-width>]]::
Junio C Hamano4a9a76a2006-10-01 05:40:2952Generate a diffstat. You can override the default
Junio C Hamanod2179ef2010-10-22 04:12:1753output width for 80-column terminal by `--stat=<width>`.
Junio C Hamano4a9a76a2006-10-01 05:40:2954The width of the filename part can be controlled by
55giving another width to it separated by a comma.
Junio C Hamanoba7c8d82006-04-15 06:17:4256
Junio C Hamanofbe00522006-10-19 05:58:4857--numstat::
Junio C Hamano3b70d3c2009-11-21 17:37:3758Similar to `\--stat`, but shows number of added and
Junio C Hamanofbe00522006-10-19 05:58:4859deleted lines in decimal notation and pathname without
Junio C Hamanod793de52006-12-26 09:11:4360abbreviation, to make it more machine friendly. For
61binary files, outputs two `-` instead of saying
62`0 0`.
Junio C Hamanofbe00522006-10-19 05:58:4863
Junio C Hamano7d23f5e2006-12-16 07:44:0464--shortstat::
Junio C Hamano3b70d3c2009-11-21 17:37:3765Output only the last line of the `--stat` format containing total
Junio C Hamano7d23f5e2006-12-16 07:44:0466number of modified files, as well as number of added and deleted
67lines.
68
Junio C Hamanod2179ef2010-10-22 04:12:1769--dirstat[=<limit>]::
Junio C Hamanoa2f46622008-09-03 05:20:3170Output the distribution of relative amount of changes (number of lines added or
71removed) for each sub-directory. Directories with changes below
72a cut-off percent (3% by default) are not shown. The cut-off percent
Junio C Hamanod2179ef2010-10-22 04:12:1773can be set with `--dirstat=<limit>`. Changes in a child directory are not
Junio C Hamano3b70d3c2009-11-21 17:37:3774counted for the parent directory, unless `--cumulative` is used.
Junio C Hamano6a45be92008-04-22 08:19:0375
Junio C Hamanod2179ef2010-10-22 04:12:1776--dirstat-by-file[=<limit>]::
Junio C Hamano3b70d3c2009-11-21 17:37:3777Same as `--dirstat`, but counts changed files instead of lines.
Junio C Hamanoa476efa2008-10-10 15:31:4278
Junio C Hamano6959c6c2006-05-17 10:34:1179--summary::
80Output a condensed summary of extended header information
81such as creations, renames and mode changes.
82
Junio C Hamano3b70d3c2009-11-21 17:37:3783ifndef::git-format-patch[]
Junio C Hamanod1308c92006-04-16 11:01:0984--patch-with-stat::
Junio C Hamano3b70d3c2009-11-21 17:37:3785Synonym for `-p --stat`.
86endif::git-format-patch[]
Junio C Hamanod1308c92006-04-16 11:01:0987
Junio C Hamano3b70d3c2009-11-21 17:37:3788ifndef::git-format-patch[]
Junio C Hamano5706e0b2009-11-24 10:54:1689
Junio C Hamano1a4e8412005-12-27 08:17:2390-z::
Junio C Hamano5706e0b2009-11-24 10:54:1691ifdef::git-log[]
92Separate 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[]
97ifndef::git-log[]
Junio C Hamano0c053e82010-04-19 06:46:3498When `--raw`, `--numstat`, `--name-only` or `--name-status` has been
99given, do not munge pathnames and use NULs as output field terminators.
Junio C Hamano5706e0b2009-11-24 10:54:16100endif::git-log[]
101+
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 Hamano1a4e8412005-12-27 08:17:23106
107--name-only::
108Show only names of changed files.
109
110--name-status::
Junio C Hamanoa9aee782008-04-23 16:09:20111Show only names and status of changed files. See the description
112of the `--diff-filter` option on what the status letters mean.
Junio C Hamano1a4e8412005-12-27 08:17:23113
Junio C Hamanoc21ab052009-10-31 04:03:55114--submodule[=<format>]::
115Chose the output format for submodule differences. <format> can be one of
116'short' and 'log'. 'short' just shows pairs of commit names, this format
117is used when this option is not given. 'log' is the default value for this
118option and lists the commits in that commit range like the 'summary'
119option of linkgit:git-submodule[1] does.
120
Junio C Hamano4aa0bcc2010-03-03 05:13:12121--color[=<when>]::
Junio C Hamano9ae1a062006-07-10 08:12:34122Show colored diff.
Junio C Hamano4aa0bcc2010-03-03 05:13:12123The value must be always (the default), never, or auto.
Junio C Hamano9ae1a062006-07-10 08:12:34124
125--no-color::
126Turn off colored diff, even when the configuration file
127gives the default to color output.
Junio C Hamano4aa0bcc2010-03-03 05:13:12128Same as `--color=never`.
Junio C Hamano9ae1a062006-07-10 08:12:34129
Junio C Hamanocc7636a2010-05-21 14:57:53130--word-diff[=<mode>]::
131Show a word diff, using the <mode> to delimit changed words.
132By default, words are delimited by whitespace; see
133`--word-diff-regex` below. The <mode> defaults to 'plain', and
134must be one of:
Junio C Hamano20d47e32009-01-26 06:36:02135+
Junio C Hamanocc7636a2010-05-21 14:57:53136--
137color::
138Highlight changed words using only colors. Implies `--color`.
139plain::
140Show words as `[-removed-]` and `{+added+}`. Makes no
141attempts to escape the delimiters if they appear in the input,
142so the output may be ambiguous.
143porcelain::
144Use a special line-based format intended for script
145consumption. Added/removed/unchanged runs are printed in the
146usual unified diff format, starting with a `+`/`-`/` `
147character at the beginning of the line and extending to the
148end of the line. Newlines in the input are represented by a
149tilde `~` on a line of its own.
150none::
151Disable 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>::
158Use <regex> to decide what a word is, instead of considering
159runs of non-whitespace to be a word. Also implies
160`--word-diff` unless it was already enabled.
161+
162Every non-overlapping match of the
Junio C Hamano20d47e32009-01-26 06:36:02163<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.
169+
170The 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.
Junio C Hamanocc7636a2010-05-21 14:57:53174
175--color-words[=<regex>]::
176Equivalent to `--word-diff=color` plus (if a regex was
177specified) `--word-diff-regex=<regex>`.
Junio C Hamano3b70d3c2009-11-21 17:37:37178endif::git-format-patch[]
Junio C Hamano85e45fa2006-08-13 07:47:41179
Junio C Hamano9ae1a062006-07-10 08:12:34180--no-renames::
181Turn off rename detection, even when the configuration
182file gives the default to do so.
183
Junio C Hamano3b70d3c2009-11-21 17:37:37184ifndef::git-format-patch[]
Junio C Hamanoa890c4f2007-01-28 10:29:21185--check::
186Warn if changes introduce trailing whitespace
Junio C Hamano3dac5042007-12-15 08:40:54187or an indent that uses a space before a tab. Exits with
188non-zero status if problems are found. Not compatible with
189--exit-code.
Junio C Hamano3b70d3c2009-11-21 17:37:37190endif::git-format-patch[]
Junio C Hamanoa890c4f2007-01-28 10:29:21191
Junio C Hamano1a4e8412005-12-27 08:17:23192--full-index::
Junio C Hamano5cf43ca2008-08-20 09:14:14193Instead of the first handful of characters, show the full
194pre- and post-image blob object names on the "index"
195line when generating patch format output.
Junio C Hamano9ae1a062006-07-10 08:12:34196
197--binary::
Junio C Hamano3b70d3c2009-11-21 17:37:37198In addition to `--full-index`, output a binary diff that
199can be applied with `git-apply`.
Junio C Hamano1a4e8412005-12-27 08:17:23200
201--abbrev[=<n>]::
202Instead of showing the full 40-byte hexadecimal object
203name in diff-raw format output and diff-tree header
Junio C Hamano6efe3022009-01-13 16:47:56204lines, show only a partial prefix. This is
Junio C Hamano3b70d3c2009-11-21 17:37:37205independent of the `--full-index` option above, which controls
Junio C Hamano1a4e8412005-12-27 08:17:23206the diff-patch output format. Non default number of
Junio C Hamano3b70d3c2009-11-21 17:37:37207digits can be specified with `--abbrev=<n>`.
Junio C Hamano1a4e8412005-12-27 08:17:23208
Junio C Hamanoe85e36f2010-08-10 05:30:14209-B[<n>][/<m>]::
Junio C Hamano39c7a692010-10-27 06:08:54210--break-rewrites[=[<n>][/<m>]]::
Junio C Hamanoe85e36f2010-08-10 05:30:14211Break complete rewrite changes into pairs of delete and
212create. This serves two purposes:
213+
214It affects the way a change that amounts to a total rewrite of a file
215not as a series of deletion and insertion mixed together with a very
216few lines that happen to match textually as the context, but as a
217single deletion of everything old followed by a single insertion of
218everything new, and the number `m` controls this aspect of the -B
219option (defaults to 60%). `-B/70%` specifies that less than 30% of the
220original should remain in the result for git to consider it a total
221rewrite (i.e. otherwise the resulting patch will be a series of
222deletion and insertion mixed together with context lines).
223+
224When used with -M, a totally-rewritten file is also considered as the
225source of a rename (usually -M only considers a file that disappeared
226as the source of a rename), and the number `n` controls this aspect of
227the -B option (defaults to 50%). `-B20%` specifies that a change with
228addition and deletion compared to 20% or more of the file's size are
229eligible for being picked up as a possible source of a rename to
230another file.
Junio C Hamano1a4e8412005-12-27 08:17:23231
Junio C Hamanoe85e36f2010-08-10 05:30:14232-M[<n>]::
Junio C Hamano0d75e872010-12-17 06:57:26233--find-renames[=<n>]::
Junio C Hamanoa574a092010-06-13 19:57:10234ifndef::git-log[]
Junio C Hamano1a4e8412005-12-27 08:17:23235Detect renames.
Junio C Hamanoa574a092010-06-13 19:57:10236endif::git-log[]
237ifdef::git-log[]
238If generating diffs, detect and report renames for each commit.
239For following files across renames while traversing history, see
240`--follow`.
241endif::git-log[]
Junio C Hamanoe85e36f2010-08-10 05:30:14242If `n` is specified, it is a is a threshold on the similarity
243index (i.e. amount of addition/deletions compared to the
244file's size). For example, `-M90%` means git should consider a
245delete/add pair to be a rename if more than 90% of the file
246hasn't changed.
Junio C Hamano1a4e8412005-12-27 08:17:23247
Junio C Hamanoe85e36f2010-08-10 05:30:14248-C[<n>]::
Junio C Hamano0d75e872010-12-17 06:57:26249--find-copies[=<n>]::
Junio C Hamano16f98872007-06-12 16:09:14250Detect copies as well as renames. See also `--find-copies-harder`.
Junio C Hamanoe85e36f2010-08-10 05:30:14251If `n` is specified, it has the same meaning as for `-M<n>`.
Junio C Hamano1a4e8412005-12-27 08:17:23252
Junio C Hamano1a4e8412005-12-27 08:17:23253--find-copies-harder::
Junio C Hamano16f98872007-06-12 16:09:14254For performance reasons, by default, `-C` option finds copies only
Junio C Hamanoa77a5132007-06-08 16:13:44255if the original file of the copy was modified in the same
Junio C Hamano1a4e8412005-12-27 08:17:23256changeset. This flag makes the command
257inspect unmodified files as candidates for the source of
258copy. This is a very expensive operation for large
Junio C Hamano16f98872007-06-12 16:09:14259projects, so use it with caution. Giving more than one
260`-C` option has the same effect.
Junio C Hamano1a4e8412005-12-27 08:17:23261
262-l<num>::
Junio C Hamano3b70d3c2009-11-21 17:37:37263The `-M` and `-C` options require O(n^2) processing time where n
Junio C Hamano1a4e8412005-12-27 08:17:23264is the number of potential rename/copy targets. This
265option prevents rename/copy detection from running if
266the number of rename/copy targets exceeds the specified
267number.
268
Junio C Hamano3b70d3c2009-11-21 17:37:37269ifndef::git-format-patch[]
Junio C Hamano982eb112010-11-18 00:53:09270--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]::
271Select only files that are Added (`A`), Copied (`C`),
272Deleted (`D`), Modified (`M`), Renamed (`R`), have their
273type (i.e. regular file, symlink, submodule, ...) changed (`T`),
274are Unmerged (`U`), are
275Unknown (`X`), or have had their pairing Broken (`B`).
276Any combination of the filter characters (including none) can be used.
277When `*` (All-or-none) is added to the combination, all
278paths are selected if there is any file that matches
279other criteria in the comparison; if there is no file
280that matches other criteria, nothing is selected.
281
Junio C Hamano1a4e8412005-12-27 08:17:23282-S<string>::
Junio C Hamano5217a272009-03-21 00:39:33283Look for differences that introduce or remove an instance of
284<string>. Note that this is different than the string simply
285appearing in diff output; see the 'pickaxe' entry in
286linkgit:gitdiffcore[7] for more details.
Junio C Hamano1a4e8412005-12-27 08:17:23287
Junio C Hamano3b4609d2010-09-30 00:04:34288-G<regex>::
289Look for differences whose added or removed line matches
290the given <regex>.
291
Junio C Hamano1a4e8412005-12-27 08:17:23292--pickaxe-all::
Junio C Hamano3b4609d2010-09-30 00:04:34293When `-S` or `-G` finds a change, show all the changes in that
Junio C Hamano1a4e8412005-12-27 08:17:23294changeset, not just the files that contain the change
295in <string>.
296
Junio C Hamanobfe9e752006-04-05 21:43:28297--pickaxe-regex::
298Make the <string> not a plain string but an extended POSIX
299regex to match.
Junio C Hamano3b70d3c2009-11-21 17:37:37300endif::git-format-patch[]
Junio C Hamanobfe9e752006-04-05 21:43:28301
Junio C Hamano1a4e8412005-12-27 08:17:23302-O<orderfile>::
303Output the patch in the order specified in the
304<orderfile>, which has one shell glob pattern per line.
305
Junio C Hamano3b70d3c2009-11-21 17:37:37306ifndef::git-format-patch[]
Junio C Hamano1a4e8412005-12-27 08:17:23307-R::
308Swap two inputs; that is, show differences from index or
309on-disk file to tree contents.
310
Junio C Hamano24bc09a2008-02-28 00:27:44311--relative[=<path>]::
312When run from a subdirectory of the project, it can be
313told to exclude changes outside the directory and show
314pathnames relative to it with this option. When you are
315not in a subdirectory (e.g. in a bare repository), you
316can name which subdirectory to make the output relative
317to by giving a <path> as an argument.
Junio C Hamano3b70d3c2009-11-21 17:37:37318endif::git-format-patch[]
Junio C Hamano24bc09a2008-02-28 00:27:44319
Junio C Hamanobbbb8652008-12-29 10:34:22320-a::
Junio C Hamanoc26f5482006-07-09 09:38:14321--text::
322Treat all files as text.
323
Junio C Hamanofd468962007-02-14 23:45:04324--ignore-space-at-eol::
Junio C Hamano3a702342007-12-12 21:34:02325Ignore changes in whitespace at EOL.
Junio C Hamanofd468962007-02-14 23:45:04326
Junio C Hamanobbbb8652008-12-29 10:34:22327-b::
Junio C Hamanod9c2d2f2006-12-06 08:59:07328--ignore-space-change::
Junio C Hamano3a702342007-12-12 21:34:02329Ignore changes in amount of whitespace. This ignores whitespace
330at line end, and considers all other sequences of one or
331more whitespace characters to be equivalent.
Junio C Hamanod9c2d2f2006-12-06 08:59:07332
Junio C Hamanobbbb8652008-12-29 10:34:22333-w::
Junio C Hamanod9c2d2f2006-12-06 08:59:07334--ignore-all-space::
Junio C Hamano3a702342007-12-12 21:34:02335Ignore whitespace when comparing lines. This ignores
336differences even if one line has whitespace where the other
Junio C Hamanod9c2d2f2006-12-06 08:59:07337line has none.
338
Junio C Hamano1d40ee82009-01-07 10:14:16339--inter-hunk-context=<lines>::
340Show the context between diff hunks, up to the specified number
341of lines, thereby fusing hunks that are close to each other.
342
Junio C Hamano3b70d3c2009-11-21 17:37:37343ifndef::git-format-patch[]
Junio C Hamano48fd2f62007-03-19 02:02:30344--exit-code::
345Make the program exit with codes similar to diff(1).
346That is, it exits with 1 if there were differences and
3470 means no differences.
348
Junio C Hamano35e57552007-03-25 07:54:35349--quiet::
Junio C Hamano3b70d3c2009-11-21 17:37:37350Disable all output of the program. Implies `--exit-code`.
351endif::git-format-patch[]
Junio C Hamano35e57552007-03-25 07:54:35352
Junio C Hamanobb0f4042007-07-04 06:41:40353--ext-diff::
354Allow an external diff helper to be executed. If you set an
Junio C Hamano35738e82008-01-07 07:55:46355external diff driver with linkgit:gitattributes[5], you need
356to use this option with linkgit:git-log[1] and friends.
Junio C Hamanobb0f4042007-07-04 06:41:40357
358--no-ext-diff::
359Disallow external diff drivers.
360
Junio C Hamano7d449522010-07-01 00:08:51361--ignore-submodules[=<when>]::
362Ignore changes to submodules in the diff generation. <when> can be
Junio C Hamano619596a2010-08-18 22:15:35363either "none", "untracked", "dirty" or "all", which is the default
364Using "none" will consider the submodule modified when it either contains
365untracked or modified files or its HEAD differs from the commit recorded
366in the superproject and can be used to override any settings of the
367'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When
Junio C Hamano7d449522010-07-01 00:08:51368"untracked" is used submodules are not considered dirty when they only
369contain untracked content (but they are still scanned for modified
370content). Using "dirty" ignores all changes to the work tree of submodules,
371only changes to the commits stored in the superproject are shown (this was
372the behavior until 1.7.0). Using "all" hides all changes to submodules.
Junio C Hamanodfccbb02008-05-26 01:16:14373
Junio C Hamanoe27cbd22007-12-21 17:57:33374--src-prefix=<prefix>::
375Show the given source prefix instead of "a/".
376
377--dst-prefix=<prefix>::
378Show the given destination prefix instead of "b/".
379
380--no-prefix::
381Do not show any source or destination prefix.
382
Junio C Hamano1a4e8412005-12-27 08:17:23383For more detailed explanation on these common options, see also
Junio C Hamanofce7c7e2008-07-02 03:06:38384linkgit:gitdiffcore[7].