format-patch: Always generate a patch
[git/dscho.git] / Documentation / diff-options.txt
blobc58d0853fc98e58dbbd13f7aed2102786ec09fa6
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.
7 ifndef::git-format-patch[]
8 ifndef::git-diff[]
9 ifndef::git-log[]
10 :git-diff-core: 1
11 endif::git-log[]
12 endif::git-diff[]
13 endif::git-format-patch[]
15 ifdef::git-format-patch[]
16 -p::
17         Generate plain patches without any diffstats.
18 endif::git-format-patch[]
20 ifndef::git-format-patch[]
21 -p::
22 -u::
23         Generate patch (see section on generating patches).
24         {git-diff? This is the default.}
25 endif::git-format-patch[]
27 -U<n>::
28 --unified=<n>::
29         Generate diffs with <n> lines of context instead of
30         the usual three.
31 ifndef::git-format-patch[]
32         Implies "-p".
33 endif::git-format-patch[]
35 --raw::
36         Generate the raw format.
37         {git-diff-core? This is the default.}
39 ifndef::git-format-patch[]
40 --patch-with-raw::
41         Synonym for "-p --raw".
42 endif::git-format-patch[]
44 --patience::
45         Generate a diff using the "patience diff" algorithm.
47 --stat[=width[,name-width]]::
48         Generate a diffstat.  You can override the default
49         output width for 80-column terminal by "--stat=width".
50         The width of the filename part can be controlled by
51         giving another width to it separated by a comma.
53 --numstat::
54         Similar to \--stat, but shows number of added and
55         deleted lines in decimal notation and pathname without
56         abbreviation, to make it more machine friendly.  For
57         binary files, outputs two `-` instead of saying
58         `0 0`.
60 --shortstat::
61         Output only the last line of the --stat format containing total
62         number of modified files, as well as number of added and deleted
63         lines.
65 --dirstat[=limit]::
66         Output the distribution of relative amount of changes (number of lines added or
67         removed) for each sub-directory. Directories with changes below
68         a cut-off percent (3% by default) are not shown. The cut-off percent
69         can be set with "--dirstat=limit". Changes in a child directory is not
70         counted for the parent directory, unless "--cumulative" is used.
72 --dirstat-by-file[=limit]::
73         Same as --dirstat, but counts changed files instead of lines.
75 --summary::
76         Output a condensed summary of extended header information
77         such as creations, renames and mode changes.
79 ifndef::git-format-patch[]
80 --patch-with-stat::
81         Synonym for "-p --stat".
82 endif::git-format-patch[]
84 -z::
85         NUL-line termination on output.  This affects the --raw
86         output field terminator.  Also output from commands such
87         as "git-log" will be delimited with NUL between commits.
89 ifndef::git-format-patch[]
90 --name-only::
91         Show only names of changed files.
93 --name-status::
94         Show only names and status of changed files. See the description
95         of the `--diff-filter` option on what the status letters mean.
96 endif::git-format-patch[]
98 --color::
99         Show colored diff.
101 --no-color::
102         Turn off colored diff, even when the configuration file
103         gives the default to color output.
105 --color-words[=<regex>]::
106         Show colored word diff, i.e., color words which have changed.
107         By default, words are separated by whitespace.
109 When a <regex> is specified, every non-overlapping match of the
110 <regex> is considered a word.  Anything between these matches is
111 considered whitespace and ignored(!) for the purposes of finding
112 differences.  You may want to append `|[^[:space:]]` to your regular
113 expression to make sure that it matches all non-whitespace characters.
114 A match that contains a newline is silently truncated(!) at the
115 newline.
117 The regex can also be set via a diff driver or configuration option, see
118 linkgit:gitattributes[1] or linkgit:git-config[1].  Giving it explicitly
119 overrides any diff driver or configuration setting.  Diff drivers
120 override configuration settings.
122 --no-renames::
123         Turn off rename detection, even when the configuration
124         file gives the default to do so.
126 ifndef::git-format-patch[]
127 --check::
128         Warn if changes introduce trailing whitespace
129         or an indent that uses a space before a tab. Exits with
130         non-zero status if problems are found. Not compatible with
131         --exit-code.
132 endif::git-format-patch[]
134 --full-index::
135         Instead of the first handful of characters, show the full
136         pre- and post-image blob object names on the "index"
137         line when generating patch format output.
139 --binary::
140         In addition to --full-index, output "binary diff" that
141         can be applied with "git apply".
143 --abbrev[=<n>]::
144         Instead of showing the full 40-byte hexadecimal object
145         name in diff-raw format output and diff-tree header
146         lines, show only a partial prefix.  This is
147         independent of --full-index option above, which controls
148         the diff-patch output format.  Non default number of
149         digits can be specified with --abbrev=<n>.
151 -B::
152         Break complete rewrite changes into pairs of delete and create.
154 -M::
155         Detect renames.
157 -C::
158         Detect copies as well as renames.  See also `--find-copies-harder`.
160 --diff-filter=[ACDMRTUXB*]::
161         Select only files that are Added (`A`), Copied (`C`),
162         Deleted (`D`), Modified (`M`), Renamed (`R`), have their
163         type (i.e. regular file, symlink, submodule, ...) changed (`T`),
164         are Unmerged (`U`), are
165         Unknown (`X`), or have had their pairing Broken (`B`).
166         Any combination of the filter characters may be used.
167         When `*` (All-or-none) is added to the combination, all
168         paths are selected if there is any file that matches
169         other criteria in the comparison; if there is no file
170         that matches other criteria, nothing is selected.
172 --find-copies-harder::
173         For performance reasons, by default, `-C` option finds copies only
174         if the original file of the copy was modified in the same
175         changeset.  This flag makes the command
176         inspect unmodified files as candidates for the source of
177         copy.  This is a very expensive operation for large
178         projects, so use it with caution.  Giving more than one
179         `-C` option has the same effect.
181 -l<num>::
182         -M and -C options require O(n^2) processing time where n
183         is the number of potential rename/copy targets.  This
184         option prevents rename/copy detection from running if
185         the number of rename/copy targets exceeds the specified
186         number.
188 -S<string>::
189         Look for differences that introduce or remove an instance of
190         <string>. Note that this is different than the string simply
191         appearing in diff output; see the 'pickaxe' entry in
192         linkgit:gitdiffcore[7] for more details.
194 --pickaxe-all::
195         When -S finds a change, show all the changes in that
196         changeset, not just the files that contain the change
197         in <string>.
199 --pickaxe-regex::
200         Make the <string> not a plain string but an extended POSIX
201         regex to match.
203 -O<orderfile>::
204         Output the patch in the order specified in the
205         <orderfile>, which has one shell glob pattern per line.
207 -R::
208         Swap two inputs; that is, show differences from index or
209         on-disk file to tree contents.
211 --relative[=<path>]::
212         When run from a subdirectory of the project, it can be
213         told to exclude changes outside the directory and show
214         pathnames relative to it with this option.  When you are
215         not in a subdirectory (e.g. in a bare repository), you
216         can name which subdirectory to make the output relative
217         to by giving a <path> as an argument.
219 -a::
220 --text::
221         Treat all files as text.
223 --ignore-space-at-eol::
224         Ignore changes in whitespace at EOL.
226 -b::
227 --ignore-space-change::
228         Ignore changes in amount of whitespace.  This ignores whitespace
229         at line end, and considers all other sequences of one or
230         more whitespace characters to be equivalent.
232 -w::
233 --ignore-all-space::
234         Ignore whitespace when comparing lines.  This ignores
235         differences even if one line has whitespace where the other
236         line has none.
238 --inter-hunk-context=<lines>::
239         Show the context between diff hunks, up to the specified number
240         of lines, thereby fusing hunks that are close to each other.
242 --exit-code::
243         Make the program exit with codes similar to diff(1).
244         That is, it exits with 1 if there were differences and
245         0 means no differences.
247 --quiet::
248         Disable all output of the program. Implies --exit-code.
250 --ext-diff::
251         Allow an external diff helper to be executed. If you set an
252         external diff driver with linkgit:gitattributes[5], you need
253         to use this option with linkgit:git-log[1] and friends.
255 --no-ext-diff::
256         Disallow external diff drivers.
258 --ignore-submodules::
259         Ignore changes to submodules in the diff generation.
261 --src-prefix=<prefix>::
262         Show the given source prefix instead of "a/".
264 --dst-prefix=<prefix>::
265         Show the given destination prefix instead of "b/".
267 --no-prefix::
268         Do not show any source or destination prefix.
270 For more detailed explanation on these common options, see also
271 linkgit:gitdiffcore[7].