git-apply(1)
============
NAME
----
git-apply - Apply a patch to files and/or to the index
SYNOPSIS
--------
[verse]
'git apply' [--stat] [--numstat] [--summary] [--check]
[--index | --intent-to-add] [--3way] [--ours | --theirs | --union]
[--apply] [--no-add] [--build-fake-ancestor=<file>] [-R | --reverse]
[--allow-binary-replacement | --binary] [--reject] [-z]
[-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached]
[--ignore-space-change | --ignore-whitespace]
[--whitespace=(nowarn|warn|fix|error|error-all)]
[--exclude=<path>] [--include=<path>] [--directory=<root>]
[--verbose | --quiet] [--unsafe-paths] [--allow-empty] [<patch>...]
DESCRIPTION
-----------
Reads the supplied diff output (i.e. "a patch") and applies it to files.
When running from a subdirectory in a repository, patched paths
outside the directory are ignored.
With the `--index` option, the patch is also applied to the index, and
with the `--cached` 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.
This command applies the patch but does not create a commit. Use
linkgit:git-am[1] to create commits from patches generated by
linkgit:git-format-patch[1] and/or received by email.
OPTIONS
-------
<patch>...::
The files to read the patch from. '-' can be used to read
from the standard input.
--stat::
Instead of applying the patch, output diffstat for the
input. Turns off "apply".
--numstat::
Similar to `--stat`, but shows the number of added and
deleted lines in decimal notation and the pathname without
abbreviation, to make it more machine friendly. For
binary files, outputs two `-` instead of saying
`0 0`. Turns off "apply".
--summary::
Instead of applying the patch, output a condensed
summary of information obtained from git diff extended
headers, such as creations, renames, and mode changes.
Turns off "apply".
--check::
Instead of applying the patch, see if the patch is
applicable to the current working tree and/or the index
file and detects errors. Turns off "apply".
--index::
Apply the patch to both the index and the working tree (or
merely check that it would apply cleanly to both if `--check` is
in effect). Note that `--index` expects index entries and
working tree copies for relevant paths to be identical (their
contents and metadata such as file mode must match), and will
raise an error if they are not, even if the patch would apply
cleanly to both the index and the working tree in isolation.
--cached::
Apply the patch to just the index, without touching the working
tree. If `--check` is in effect, merely check that it would
apply cleanly to the index entry.
--intent-to-add::
When applying the patch only to the working tree, mark new
files to be added to the index later (see `--intent-to-add`
option in linkgit:git-add[1]). This option is ignored unless
running in a Git repository and `--index` is not specified.
Note that `--index` could be implied by other options such
as `--cached` or `--3way`.
-3::
--3way::
Attempt 3-way merge if the patch records the identity of blobs it is supposed
to apply to and we have those blobs available locally, possibly leaving the
conflict markers in the files in the working tree for the user to
resolve. This option implies the `--index` option unless the
`--cached` option is used, and is incompatible with the `--reject` option.
When used with the `--cached` option, any conflicts are left at higher stages
in the cache.
--ours::
--theirs::
--union::
Instead of leaving conflicts in the file, resolve conflicts favouring
our (or their or both) side of the lines. Requires --3way.
--build-fake-ancestor=<file>::
Newer 'git diff' output has embedded 'index information'
for each blob to help identify the original version that
the patch applies to. When this flag is given, and if
the original versions of the blobs are available