Merge branch 'bg/apply-doc'
* bg/apply-doc: Fix over-simplified documentation for 'git log -z' apply: Use the term "working tree" consistently apply: Format all options using back-quotes apply: apply works outside a repository Clarify and correct -z
This commit is contained in:
commit
d2cd66556d
@ -85,10 +85,23 @@ ifndef::git-format-patch[]
|
|||||||
endif::git-format-patch[]
|
endif::git-format-patch[]
|
||||||
|
|
||||||
ifndef::git-format-patch[]
|
ifndef::git-format-patch[]
|
||||||
|
|
||||||
-z::
|
-z::
|
||||||
NUL-line termination on output. This affects the `--raw`
|
ifdef::git-log[]
|
||||||
output field terminator. Also output from commands such
|
Separate the commits with NULs instead of with new newlines.
|
||||||
as `git-log` will be delimited with NUL between commits.
|
+
|
||||||
|
Also, when `--raw` or `--numstat` has been given, do not munge
|
||||||
|
pathnames and use NULs as output field terminators.
|
||||||
|
endif::git-log[]
|
||||||
|
ifndef::git-log[]
|
||||||
|
When `--raw` or `--numstat` has been given, do not munge
|
||||||
|
pathnames and use NULs as output field terminators.
|
||||||
|
endif::git-log[]
|
||||||
|
+
|
||||||
|
Without this option, each pathname output will have TAB, LF, double quotes,
|
||||||
|
and backslash characters replaced with `\t`, `\n`, `\"`, and `\\`,
|
||||||
|
respectively, and the pathname will be enclosed in double quotes if
|
||||||
|
any of those replacements occurred.
|
||||||
|
|
||||||
--name-only::
|
--name-only::
|
||||||
Show only names of changed files.
|
Show only names of changed files.
|
||||||
|
@ -3,7 +3,7 @@ git-apply(1)
|
|||||||
|
|
||||||
NAME
|
NAME
|
||||||
----
|
----
|
||||||
git-apply - Apply a patch on a git index file and/or a working tree
|
git-apply - Apply a patch to files and/or to the index
|
||||||
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
@ -20,8 +20,11 @@ SYNOPSIS
|
|||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
Reads supplied 'diff' output and applies it on a git index file
|
Reads the supplied diff output (i.e. "a patch") and applies it to files.
|
||||||
and a work tree.
|
With the `--index` option the patch is also applied to the index, and
|
||||||
|
with the `--cache` option the patch is only applied to the index.
|
||||||
|
Without these options, the command applies the patch only to files,
|
||||||
|
and does not require them to be in a git repository.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-------
|
-------
|
||||||
@ -34,7 +37,7 @@ OPTIONS
|
|||||||
input. Turns off "apply".
|
input. Turns off "apply".
|
||||||
|
|
||||||
--numstat::
|
--numstat::
|
||||||
Similar to \--stat, but shows the number of added and
|
Similar to `--stat`, but shows the number of added and
|
||||||
deleted lines in decimal notation and the pathname without
|
deleted lines in decimal notation and the pathname without
|
||||||
abbreviation, to make it more machine friendly. For
|
abbreviation, to make it more machine friendly. For
|
||||||
binary files, outputs two `-` instead of saying
|
binary files, outputs two `-` instead of saying
|
||||||
@ -48,22 +51,22 @@ OPTIONS
|
|||||||
|
|
||||||
--check::
|
--check::
|
||||||
Instead of applying the patch, see if the patch is
|
Instead of applying the patch, see if the patch is
|
||||||
applicable to the current work tree and/or the index
|
applicable to the current working tree and/or the index
|
||||||
file and detects errors. Turns off "apply".
|
file and detects errors. Turns off "apply".
|
||||||
|
|
||||||
--index::
|
--index::
|
||||||
When --check is in effect, or when applying the patch
|
When `--check` is in effect, or when applying the patch
|
||||||
(which is the default when none of the options that
|
(which is the default when none of the options that
|
||||||
disables it is in effect), make sure the patch is
|
disables it is in effect), make sure the patch is
|
||||||
applicable to what the current index file records. If
|
applicable to what the current index file records. If
|
||||||
the file to be patched in the work tree is not
|
the file to be patched in the working tree is not
|
||||||
up-to-date, it is flagged as an error. This flag also
|
up-to-date, it is flagged as an error. This flag also
|
||||||
causes the index file to be updated.
|
causes the index file to be updated.
|
||||||
|
|
||||||
--cached::
|
--cached::
|
||||||
Apply a patch without touching the working tree. Instead take the
|
Apply a patch without touching the working tree. Instead take the
|
||||||
cached data, apply the patch, and store the result in the index
|
cached data, apply the patch, and store the result in the index
|
||||||
without using the working tree. This implies '--index'.
|
without using the working tree. This implies `--index`.
|
||||||
|
|
||||||
--build-fake-ancestor=<file>::
|
--build-fake-ancestor=<file>::
|
||||||
Newer 'git-diff' output has embedded 'index information'
|
Newer 'git-diff' output has embedded 'index information'
|
||||||
@ -87,11 +90,13 @@ the information is read from the current index instead.
|
|||||||
rejected hunks in corresponding *.rej files.
|
rejected hunks in corresponding *.rej files.
|
||||||
|
|
||||||
-z::
|
-z::
|
||||||
When showing the index information, do not munge paths,
|
When `--numstat` has been given, do not munge pathnames,
|
||||||
but use NUL terminated machine readable format. Without
|
but use a NUL-terminated machine-readable format.
|
||||||
this flag, the pathnames output will have TAB, LF, and
|
+
|
||||||
backslash characters replaced with `\t`, `\n`, and `\\`,
|
Without this option, each pathname output will have TAB, LF, double quotes,
|
||||||
respectively.
|
and backslash characters replaced with `\t`, `\n`, `\"`, and `\\`,
|
||||||
|
respectively, and the pathname will be enclosed in double quotes if
|
||||||
|
any of those replacements occurred.
|
||||||
|
|
||||||
-p<n>::
|
-p<n>::
|
||||||
Remove <n> leading slashes from traditional diff paths. The
|
Remove <n> leading slashes from traditional diff paths. The
|
||||||
@ -107,8 +112,8 @@ the information is read from the current index instead.
|
|||||||
By default, 'git-apply' expects that the patch being
|
By default, 'git-apply' expects that the patch being
|
||||||
applied is a unified diff with at least one line of context.
|
applied is a unified diff with at least one line of context.
|
||||||
This provides good safety measures, but breaks down when
|
This provides good safety measures, but breaks down when
|
||||||
applying a diff generated with --unified=0. To bypass these
|
applying a diff generated with `--unified=0`. To bypass these
|
||||||
checks use '--unidiff-zero'.
|
checks use `--unidiff-zero`.
|
||||||
+
|
+
|
||||||
Note, for the reasons stated above usage of context-free patches is
|
Note, for the reasons stated above usage of context-free patches is
|
||||||
discouraged.
|
discouraged.
|
||||||
@ -144,7 +149,7 @@ discouraged.
|
|||||||
be useful when importing patchsets, where you want to include certain
|
be useful when importing patchsets, where you want to include certain
|
||||||
files or directories.
|
files or directories.
|
||||||
+
|
+
|
||||||
When --exclude and --include patterns are used, they are examined in the
|
When `--exclude` and `--include` patterns are used, they are examined in the
|
||||||
order they appear on the command line, and the first match determines if a
|
order they appear on the command line, and the first match determines if a
|
||||||
patch to each path is used. A patch to a path that does not match any
|
patch to each path is used. A patch to a path that does not match any
|
||||||
include/exclude pattern is used by default if there is no include pattern
|
include/exclude pattern is used by default if there is no include pattern
|
||||||
@ -227,13 +232,13 @@ Submodules
|
|||||||
If the patch contains any changes to submodules then 'git-apply'
|
If the patch contains any changes to submodules then 'git-apply'
|
||||||
treats these changes as follows.
|
treats these changes as follows.
|
||||||
|
|
||||||
If --index is specified (explicitly or implicitly), then the submodule
|
If `--index` is specified (explicitly or implicitly), then the submodule
|
||||||
commits must match the index exactly for the patch to apply. If any
|
commits must match the index exactly for the patch to apply. If any
|
||||||
of the submodules are checked-out, then these check-outs are completely
|
of the submodules are checked-out, then these check-outs are completely
|
||||||
ignored, i.e., they are not required to be up-to-date or clean and they
|
ignored, i.e., they are not required to be up-to-date or clean and they
|
||||||
are not updated.
|
are not updated.
|
||||||
|
|
||||||
If --index is not specified, then the submodule commits in the patch
|
If `--index` is not specified, then the submodule commits in the patch
|
||||||
are ignored and only the absence or presence of the corresponding
|
are ignored and only the absence or presence of the corresponding
|
||||||
subdirectory is checked and (if possible) updated.
|
subdirectory is checked and (if possible) updated.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user