blob: 9276faeb11aec2650393c56fe5edf2b571692dbd [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 Hamanoff979792007-11-16 10:11:3017Generate patches without diffstat.
18endif::git-format-patch[]
19
20ifndef::git-format-patch[]
21-p::
Junio C Hamanobbbb8652008-12-29 10:34:2222-u::
Junio C Hamanoff979792007-11-16 10:11:3023Generate patch (see section on generating patches).
24{git-diff? This is the default.}
25endif::git-format-patch[]
Junio C Hamano1a4e8412005-12-27 08:17:2326
Junio C Hamano69361562007-07-26 02:14:3427-U<n>::
Junio C Hamano69361562007-07-26 02:14:3428--unified=<n>::
29Generate diffs with <n> lines of context instead of
30the usual three. Implies "-p".
31
Junio C Hamano9ae1a062006-07-10 08:12:3432--raw::
33Generate the raw format.
Junio C Hamanoff979792007-11-16 10:11:3034{git-diff-core? This is the default.}
Junio C Hamano9ae1a062006-07-10 08:12:3435
Junio C Hamano54559c82006-04-13 07:45:1236--patch-with-raw::
Junio C Hamano9ae1a062006-07-10 08:12:3437Synonym for "-p --raw".
Junio C Hamano54559c82006-04-13 07:45:1238
Junio C Hamano20d47e32009-01-26 06:36:0239--patience::
Junio C Hamano22bcc112009-01-24 08:05:1840Generate a diff using the "patience diff" algorithm.
41
Junio C Hamano4a9a76a2006-10-01 05:40:2942--stat[=width[,name-width]]::
43Generate a diffstat. You can override the default
44output width for 80-column terminal by "--stat=width".
45The width of the filename part can be controlled by
46giving another width to it separated by a comma.
Junio C Hamanoba7c8d82006-04-15 06:17:4247
Junio C Hamanofbe00522006-10-19 05:58:4848--numstat::
49Similar to \--stat, but shows number of added and
50deleted lines in decimal notation and pathname without
Junio C Hamanod793de52006-12-26 09:11:4351abbreviation, to make it more machine friendly. For
52binary files, outputs two `-` instead of saying
53`0 0`.
Junio C Hamanofbe00522006-10-19 05:58:4854
Junio C Hamano7d23f5e2006-12-16 07:44:0455--shortstat::
56Output only the last line of the --stat format containing total
57number of modified files, as well as number of added and deleted
58lines.
59
Junio C Hamano6a45be92008-04-22 08:19:0360--dirstat[=limit]::
Junio C Hamanoa2f46622008-09-03 05:20:3161Output the distribution of relative amount of changes (number of lines added or
62removed) for each sub-directory. Directories with changes below
63a cut-off percent (3% by default) are not shown. The cut-off percent
64can be set with "--dirstat=limit". Changes in a child directory is not
65counted for the parent directory, unless "--cumulative" is used.
Junio C Hamano6a45be92008-04-22 08:19:0366
Junio C Hamanoa476efa2008-10-10 15:31:4267--dirstat-by-file[=limit]::
68Same as --dirstat, but counts changed files instead of lines.
69
Junio C Hamano6959c6c2006-05-17 10:34:1170--summary::
71Output a condensed summary of extended header information
72such as creations, renames and mode changes.
73
Junio C Hamanod1308c92006-04-16 11:01:0974--patch-with-stat::
Junio C Hamano9ae1a062006-07-10 08:12:3475Synonym for "-p --stat".
Junio C Hamanoff979792007-11-16 10:11:3076{git-format-patch? This is the default.}
Junio C Hamanod1308c92006-04-16 11:01:0977
Junio C Hamano1a4e8412005-12-27 08:17:2378-z::
Junio C Hamanob968dbb2007-07-27 07:26:4079NUL-line termination on output. This affects the --raw
80output field terminator. Also output from commands such
81as "git-log" will be delimited with NUL between commits.
Junio C Hamano1a4e8412005-12-27 08:17:2382
83--name-only::
84Show only names of changed files.
85
86--name-status::
Junio C Hamanoa9aee782008-04-23 16:09:2087Show only names and status of changed files. See the description
88of the `--diff-filter` option on what the status letters mean.
Junio C Hamano1a4e8412005-12-27 08:17:2389
Junio C Hamano9ae1a062006-07-10 08:12:3490--color::
91Show colored diff.
92
93--no-color::
94Turn off colored diff, even when the configuration file
95gives the default to color output.
96
Junio C Hamano20d47e32009-01-26 06:36:0297--color-words[=<regex>]::
98Show colored word diff, i.e., color words which have changed.
99By default, words are separated by whitespace.
100+
101When a <regex> is specified, every non-overlapping match of the
102<regex> is considered a word. Anything between these matches is
103considered whitespace and ignored(!) for the purposes of finding
104differences. You may want to append `|[^[:space:]]` to your regular
105expression to make sure that it matches all non-whitespace characters.
106A match that contains a newline is silently truncated(!) at the
107newline.
108+
109The regex can also be set via a diff driver or configuration option, see
110linkgit:gitattributes[1] or linkgit:git-config[1]. Giving it explicitly
111overrides any diff driver or configuration setting. Diff drivers
112override configuration settings.
Junio C Hamano85e45fa2006-08-13 07:47:41113
Junio C Hamano9ae1a062006-07-10 08:12:34114--no-renames::
115Turn off rename detection, even when the configuration
116file gives the default to do so.
117
Junio C Hamanoa890c4f2007-01-28 10:29:21118--check::
119Warn if changes introduce trailing whitespace
Junio C Hamano3dac5042007-12-15 08:40:54120or an indent that uses a space before a tab. Exits with
121non-zero status if problems are found. Not compatible with
122--exit-code.
Junio C Hamanoa890c4f2007-01-28 10:29:21123
Junio C Hamano1a4e8412005-12-27 08:17:23124--full-index::
Junio C Hamano5cf43ca2008-08-20 09:14:14125Instead of the first handful of characters, show the full
126pre- and post-image blob object names on the "index"
127line when generating patch format output.
Junio C Hamano9ae1a062006-07-10 08:12:34128
129--binary::
130In addition to --full-index, output "binary diff" that
131can be applied with "git apply".
Junio C Hamano1a4e8412005-12-27 08:17:23132
133--abbrev[=<n>]::
134Instead of showing the full 40-byte hexadecimal object
135name in diff-raw format output and diff-tree header
Junio C Hamano6efe3022009-01-13 16:47:56136lines, show only a partial prefix. This is
Junio C Hamano1a4e8412005-12-27 08:17:23137independent of --full-index option above, which controls
138the diff-patch output format. Non default number of
139digits can be specified with --abbrev=<n>.
140
141-B::
142Break complete rewrite changes into pairs of delete and create.
143
144-M::
145Detect renames.
146
147-C::
Junio C Hamano16f98872007-06-12 16:09:14148Detect copies as well as renames. See also `--find-copies-harder`.
Junio C Hamano1a4e8412005-12-27 08:17:23149
Junio C Hamano6ec31b92006-02-10 05:52:01150--diff-filter=[ACDMRTUXB*]::
151Select only files that are Added (`A`), Copied (`C`),
152Deleted (`D`), Modified (`M`), Renamed (`R`), have their
Junio C Hamanoa2deec52008-10-18 18:58:09153type (i.e. regular file, symlink, submodule, ...) changed (`T`),
154are Unmerged (`U`), are
Junio C Hamano6ec31b92006-02-10 05:52:01155Unknown (`X`), or have had their pairing Broken (`B`).
156Any combination of the filter characters may be used.
157When `*` (All-or-none) is added to the combination, all
158paths are selected if there is any file that matches
159other criteria in the comparison; if there is no file
160that matches other criteria, nothing is selected.
161
Junio C Hamano1a4e8412005-12-27 08:17:23162--find-copies-harder::
Junio C Hamano16f98872007-06-12 16:09:14163For performance reasons, by default, `-C` option finds copies only
Junio C Hamanoa77a5132007-06-08 16:13:44164if the original file of the copy was modified in the same
Junio C Hamano1a4e8412005-12-27 08:17:23165changeset. This flag makes the command
166inspect unmodified files as candidates for the source of
167copy. This is a very expensive operation for large
Junio C Hamano16f98872007-06-12 16:09:14168projects, so use it with caution. Giving more than one
169`-C` option has the same effect.
Junio C Hamano1a4e8412005-12-27 08:17:23170
171-l<num>::
172-M and -C options require O(n^2) processing time where n
173is the number of potential rename/copy targets. This
174option prevents rename/copy detection from running if
175the number of rename/copy targets exceeds the specified
176number.
177
178-S<string>::
Junio C Hamano5217a272009-03-21 00:39:33179Look for differences that introduce or remove an instance of
180<string>. Note that this is different than the string simply
181appearing in diff output; see the 'pickaxe' entry in
182linkgit:gitdiffcore[7] for more details.
Junio C Hamano1a4e8412005-12-27 08:17:23183
184--pickaxe-all::
185When -S finds a change, show all the changes in that
186changeset, not just the files that contain the change
187in <string>.
188
Junio C Hamanobfe9e752006-04-05 21:43:28189--pickaxe-regex::
190Make the <string> not a plain string but an extended POSIX
191regex to match.
192
Junio C Hamano1a4e8412005-12-27 08:17:23193-O<orderfile>::
194Output the patch in the order specified in the
195<orderfile>, which has one shell glob pattern per line.
196
197-R::
198Swap two inputs; that is, show differences from index or
199on-disk file to tree contents.
200
Junio C Hamano24bc09a2008-02-28 00:27:44201--relative[=<path>]::
202When run from a subdirectory of the project, it can be
203told to exclude changes outside the directory and show
204pathnames relative to it with this option. When you are
205not in a subdirectory (e.g. in a bare repository), you
206can name which subdirectory to make the output relative
207to by giving a <path> as an argument.
208
Junio C Hamanobbbb8652008-12-29 10:34:22209-a::
Junio C Hamanoc26f5482006-07-09 09:38:14210--text::
211Treat all files as text.
212
Junio C Hamanofd468962007-02-14 23:45:04213--ignore-space-at-eol::
Junio C Hamano3a702342007-12-12 21:34:02214Ignore changes in whitespace at EOL.
Junio C Hamanofd468962007-02-14 23:45:04215
Junio C Hamanobbbb8652008-12-29 10:34:22216-b::
Junio C Hamanod9c2d2f2006-12-06 08:59:07217--ignore-space-change::
Junio C Hamano3a702342007-12-12 21:34:02218Ignore changes in amount of whitespace. This ignores whitespace
219at line end, and considers all other sequences of one or
220more whitespace characters to be equivalent.
Junio C Hamanod9c2d2f2006-12-06 08:59:07221
Junio C Hamanobbbb8652008-12-29 10:34:22222-w::
Junio C Hamanod9c2d2f2006-12-06 08:59:07223--ignore-all-space::
Junio C Hamano3a702342007-12-12 21:34:02224Ignore whitespace when comparing lines. This ignores
225differences even if one line has whitespace where the other
Junio C Hamanod9c2d2f2006-12-06 08:59:07226line has none.
227
Junio C Hamano1d40ee82009-01-07 10:14:16228--inter-hunk-context=<lines>::
229Show the context between diff hunks, up to the specified number
230of lines, thereby fusing hunks that are close to each other.
231
Junio C Hamano48fd2f62007-03-19 02:02:30232--exit-code::
233Make the program exit with codes similar to diff(1).
234That is, it exits with 1 if there were differences and
2350 means no differences.
236
Junio C Hamano35e57552007-03-25 07:54:35237--quiet::
238Disable all output of the program. Implies --exit-code.
239
Junio C Hamanobb0f4042007-07-04 06:41:40240--ext-diff::
241Allow an external diff helper to be executed. If you set an
Junio C Hamano35738e82008-01-07 07:55:46242external diff driver with linkgit:gitattributes[5], you need
243to use this option with linkgit:git-log[1] and friends.
Junio C Hamanobb0f4042007-07-04 06:41:40244
245--no-ext-diff::
246Disallow external diff drivers.
247
Junio C Hamanodfccbb02008-05-26 01:16:14248--ignore-submodules::
249Ignore changes to submodules in the diff generation.
250
Junio C Hamanoe27cbd22007-12-21 17:57:33251--src-prefix=<prefix>::
252Show the given source prefix instead of "a/".
253
254--dst-prefix=<prefix>::
255Show the given destination prefix instead of "b/".
256
257--no-prefix::
258Do not show any source or destination prefix.
259
Junio C Hamano1a4e8412005-12-27 08:17:23260For more detailed explanation on these common options, see also
Junio C Hamanofce7c7e2008-07-02 03:06:38261linkgit:gitdiffcore[7].