@@ -8,8 +8,8 @@ git-apply - Apply a patch to files and/or to the index
88
99SYNOPSIS
1010--------
11- [verse ]
12- ' git apply' [-- stat] [-- numstat] [-- summary] [-- check]
11+ [synopsis ]
12+ git apply [-- stat] [-- numstat] [-- summary] [-- check]
1313 [-- index | -- intent-to-add] [-- 3way] [-- ours | -- theirs | -- union]
1414 [-- apply] [-- no-add] [-- build-fake-ancestor=<file >] [-R | -- reverse]
1515 [-- allow-binary-replacement | -- binary] [-- reject] [-z]
@@ -35,33 +35,33 @@ linkgit:git-format-patch[1] and/or received by email.
3535
3636OPTIONS
3737-------
38- <patch >... ::
39- The files to read the patch from. '-' can be used to read
38+ ` <patch>...` ::
39+ The files to read the patch from. `-` can be used to read
4040 from the standard input.
4141
42- -- stat::
42+ ` --stat` ::
4343 Instead of applying the patch, output diffstat for the
4444 input. Turns off "apply".
4545
46- -- numstat::
46+ ` --numstat` ::
4747 Similar to `--stat` , but shows the number of added and
4848 deleted lines in decimal notation and the pathname without
4949 abbreviation, to make it more machine friendly. For
5050 binary files, outputs two `-` instead of saying
5151 `0 0` . Turns off "apply".
5252
53- -- summary::
53+ ` --summary` ::
5454 Instead of applying the patch, output a condensed
5555 summary of information obtained from git diff extended
5656 headers, such as creations, renames, and mode changes.
5757 Turns off "apply".
5858
59- -- check::
59+ ` --check` ::
6060 Instead of applying the patch, see if the patch is
6161 applicable to the current working tree and/or the index
6262 file and detects errors. Turns off "apply".
6363
64- -- index::
64+ ` --index` ::
6565 Apply the patch to both the index and the working tree (or
6666 merely check that it would apply cleanly to both if `--check` is
6767 in effect). Note that `--index` expects index entries and
@@ -70,22 +70,22 @@ OPTIONS
7070 raise an error if they are not, even if the patch would apply
7171 cleanly to both the index and the working tree in isolation.
7272
73- -- cached::
73+ ` --cached` ::
7474 Apply the patch to just the index, without touching the working
7575 tree. If `--check` is in effect, merely check that it would
7676 apply cleanly to the index entry.
7777
78- -N ::
79- -- intent-to-add::
78+ `-N` ::
79+ ` --intent-to-add` ::
8080 When applying the patch only to the working tree, mark new
8181 files to be added to the index later (see `--intent-to-add`
8282 option in linkgit:git-add[1]). This option is ignored if
8383 `--index` or `--cached` are used, and has no effect outside a Git
8484 repository. Note that `--index` could be implied by other options
8585 such as `--3way` .
8686
87- -3 ::
88- -- 3way::
87+ `-3` ::
88+ ` --3way` ::
8989 Attempt 3-way merge if the patch records the identity of blobs it is supposed
9090 to apply to and we have those blobs available locally, possibly leaving the
9191 conflict markers in the files in the working tree for the user to
@@ -94,14 +94,14 @@ OPTIONS
9494 When used with the `--cached` option, any conflicts are left at higher stages
9595 in the cache.
9696
97- -- ours::
98- -- theirs::
99- -- union::
97+ ` --ours` ::
98+ ` --theirs` ::
99+ ` --union` ::
100100 Instead of leaving conflicts in the file, resolve conflicts favouring
101- our (or their or both) side of the lines. Requires -- 3way.
101+ our (or their or both) side of the lines. Requires ` --3way` .
102102
103- -- build-fake-ancestor=<file >::
104- Newer ' git diff' output has embedded 'index information'
103+ ` --build-fake-ancestor=<file>` ::
104+ Newer ` git diff` output has embedded 'index information'
105105 for each blob to help identify the original version that
106106 the patch applies to. When this flag is given, and if
107107 the original versions of the blobs are available locally,
@@ -110,39 +110,39 @@ OPTIONS
110110When a pure mode change is encountered (which has no index information),
111111the information is read from the current index instead.
112112
113- -R ::
114- -- reverse::
113+ `-R` ::
114+ ` --reverse` ::
115115 Apply the patch in reverse.
116116
117- -- reject::
118- For atomicity, ' git apply' by default fails the whole patch and
117+ ` --reject` ::
118+ For atomicity, ` git apply` by default fails the whole patch and
119119 does not touch the working tree when some of the hunks
120120 do not apply. This option makes it apply
121121 the parts of the patch that are applicable, and leave the
122- rejected hunks in corresponding *.rej files.
122+ rejected hunks in corresponding ` *.rej` files.
123123
124- -z ::
124+ `-z` ::
125125 When `--numstat` has been given, do not munge pathnames,
126126 but use a NUL-terminated machine-readable format.
127127+
128128Without this option, pathnames with "unusual" characters are quoted as
129129explained for the configuration variable `core.quotePath` (see
130130linkgit:git-config[1]).
131131
132- -p<n>::
133- Remove <n> leading path components (separated by slashes) from
132+ ` -p<n>` ::
133+ Remove _ <n>_ leading path components (separated by slashes) from
134134 traditional diff paths. E.g., with `-p2` , a patch against
135135 `a/dir/file` will be applied directly to `file` . The default is
136136 1.
137137
138- -C<n>::
139- Ensure at least <n> lines of surrounding context match before
138+ ` -C<n>` ::
139+ Ensure at least _ <n>_ lines of surrounding context match before
140140 and after each change. When fewer lines of surrounding
141141 context exist they all must match. By default no context is
142142 ever ignored.
143143
144- --unidiff-zero::
145- By default, ' git apply' expects that the patch being
144+ ` --unidiff-zero` ::
145+ By default, ` git apply` expects that the patch being
146146 applied is a unified diff with at least one line of context.
147147 This provides good safety measures, but breaks down when
148148 applying a diff generated with `--unified=0` . To bypass these
@@ -151,34 +151,34 @@ linkgit:git-config[1]).
151151Note, for the reasons stated above, the usage of context-free patches is
152152discouraged.
153153
154- --apply::
154+ ` --apply` ::
155155 If you use any of the options marked "Turns off
156- 'apply'" above, ' git apply' reads and outputs the
156+ 'apply' " above, ` git apply` reads and outputs the
157157 requested information without actually applying the
158158 patch. Give this flag after those flags to also apply
159159 the patch.
160160
161- --no-add::
161+ ` --no-add` ::
162162 When applying a patch, ignore additions made by the
163163 patch. This can be used to extract the common part between
164- two files by first running ' diff' on them and applying
164+ two files by first running ` diff` on them and applying
165165 the result with this option, which would apply the
166166 deletion part but not the addition part.
167167
168- --allow-binary-replacement::
169- --binary::
168+ ` --allow-binary-replacement` ::
169+ ` --binary` ::
170170 Historically we did not allow binary patch application
171171 without an explicit permission from the user, and this
172172 flag was the way to do so. Currently, we always allow binary
173173 patch application, so this is a no-op.
174174
175- --exclude=<path-pattern>::
176- Don't apply changes to files matching the given path pattern. This can
175+ ` --exclude=<path-pattern>` ::
176+ Don't apply changes to files matching _< path- pattern>_ . This can
177177 be useful when importing patchsets, where you want to exclude certain
178178 files or directories.
179179
180- --include=<path-pattern>::
181- Apply changes to files matching the given path pattern. This can
180+ ` --include=<path-pattern>` ::
181+ Apply changes to files matching the _< path- pattern>_ . This can
182182 be useful when importing patchsets, where you want to include certain
183183 files or directories.
184184+
@@ -188,15 +188,15 @@ patch to each path is used. A patch to a path that does not match any
188188include/exclude pattern is used by default if there is no include pattern
189189on the command line, and ignored if there is any include pattern.
190190
191- --ignore-space-change::
192- --ignore-whitespace::
191+ ` --ignore-space-change` ::
192+ ` --ignore-whitespace` ::
193193 When applying a patch, ignore changes in whitespace in context
194194 lines if necessary.
195195 Context lines will preserve their whitespace, and they will not
196196 undergo whitespace fixing regardless of the value of the
197197 `--whitespace` option. New lines will still be fixed, though.
198198
199- --whitespace=<action>::
199+ ` --whitespace=<action>` ::
200200 When applying a patch, detect a new or modified line that has
201201 whitespace errors. What are considered whitespace errors is
202202 controlled by `core.whitespace` configuration. By default,
@@ -209,7 +209,7 @@ By default, the command outputs warning messages but applies the patch.
209209When `git-apply` is used for statistics and not applying a
210210patch, it defaults to `nowarn` .
211211+
212- You can use different ` <action>` values to control this
212+ You can use different _ <action>_ values to control this
213213behavior:
214214+
215215* `nowarn` turns off the trailing whitespace warning.
@@ -223,48 +223,48 @@ behavior:
223223 to apply the patch.
224224* `error-all` is similar to `error` but shows all errors.
225225
226- --inaccurate-eof::
227- Under certain circumstances, some versions of ' diff' do not correctly
226+ ` --inaccurate-eof` ::
227+ Under certain circumstances, some versions of ` diff` do not correctly
228228 detect a missing new-line at the end of the file. As a result, patches
229- created by such ' diff' programs do not record incomplete lines
229+ created by such ` diff` programs do not record incomplete lines
230230 correctly. This option adds support for applying such patches by
231231 working around this bug.
232232
233- -v ::
234- --verbose::
233+ `-v` ::
234+ ` --verbose` ::
235235 Report progress to stderr. By default, only a message about the
236236 current patch being applied will be printed. This option will cause
237237 additional information to be reported.
238238
239- -q ::
240- --quiet::
239+ `-q` ::
240+ ` --quiet` ::
241241 Suppress stderr output. Messages about patch status and progress
242242 will not be printed.
243243
244- --recount::
244+ ` --recount` ::
245245 Do not trust the line counts in the hunk headers, but infer them
246246 by inspecting the patch (e.g. after editing the patch without
247247 adjusting the hunk headers appropriately).
248248
249- --directory=<root>::
250- Prepend <root> to all filenames. If a "-p" argument was also passed,
249+ ` --directory=<root>` ::
250+ Prepend _ <root>_ to all filenames. If a `-p` argument was also passed,
251251 it is applied before prepending the new root.
252252+
253253For example, a patch that talks about updating `a/git-gui.sh` to `b/git-gui.sh`
254254can be applied to the file in the working tree `modules/git-gui/git-gui.sh` by
255255running `git apply --directory=modules/git-gui` .
256256
257- --unsafe-paths::
257+ ` --unsafe-paths` ::
258258 By default, a patch that affects outside the working area
259259 (either a Git controlled working tree, or the current working
260- directory when " git apply" is used as a replacement of GNU
261- patch) is rejected as a mistake (or a mischief).
260+ directory when ` git apply` is used as a replacement of GNU
261+ ` patch` ) is rejected as a mistake (or a mischief).
262262+
263- When `git apply` is used as a "better GNU patch", the user can pass
263+ When `git apply` is used as a "better GNU ` patch` ", the user can pass
264264the `--unsafe-paths` option to override this safety check. This option
265265has no effect when `--index` or `--cached` is in use.
266266
267- --allow-empty::
267+ ` --allow-empty` ::
268268 Don't return an error for patches containing no diff. This includes
269269 empty patches and patches with commit text only.
270270
@@ -273,11 +273,12 @@ CONFIGURATION
273273
274274include::includes/cmd-config-section-all.adoc[]
275275
276+ :git-apply: 1
276277include::config/apply.adoc[]
277278
278279SUBMODULES
279280----------
280- If the patch contains any changes to submodules then ' git apply'
281+ If the patch contains any changes to submodules then ` git apply`
281282treats these changes as follows.
282283
283284If `--index` is specified (explicitly or implicitly), then the submodule
0 commit comments