Documentation / git-apply.txton commit Merge branch 'eb/quilt' (667661d)
   1git-apply(1)
   2============
   3
   4NAME
   5----
   6git-apply - Apply patch on a git index file and a work tree
   7
   8
   9SYNOPSIS
  10--------
  11[verse]
  12'git-apply' [--stat] [--numstat] [--summary] [--check] [--index] [--apply]
  13          [--no-add] [--index-info] [--allow-binary-replacement] [-z] [-pNUM]
  14          [-CNUM] [--whitespace=<nowarn|warn|error|error-all|strip>]
  15          [<patch>...]
  16
  17DESCRIPTION
  18-----------
  19Reads supplied diff output and applies it on a git index file
  20and a work tree.
  21
  22OPTIONS
  23-------
  24<patch>...::
  25        The files to read patch from.  '-' can be used to read
  26        from the standard input.
  27
  28--stat::
  29        Instead of applying the patch, output diffstat for the
  30        input.  Turns off "apply".
  31
  32--numstat::
  33        Similar to \--stat, but shows number of added and
  34        deleted lines in decimal notation and pathname without
  35        abbreviation, to make it more machine friendly.  Turns
  36        off "apply".
  37
  38--summary::
  39        Instead of applying the patch, output a condensed
  40        summary of information obtained from git diff extended
  41        headers, such as creations, renames and mode changes.
  42        Turns off "apply".
  43
  44--check::
  45        Instead of applying the patch, see if the patch is
  46        applicable to the current work tree and/or the index
  47        file and detects errors.  Turns off "apply".
  48
  49--index::
  50        When --check is in effect, or when applying the patch
  51        (which is the default when none of the options that
  52        disables it is in effect), make sure the patch is
  53        applicable to what the current index file records.  If
  54        the file to be patched in the work tree is not
  55        up-to-date, it is flagged as an error.  This flag also
  56        causes the index file to be updated.
  57
  58--index-info::
  59        Newer git-diff output has embedded 'index information'
  60        for each blob to help identify the original version that
  61        the patch applies to.  When this flag is given, and if
  62        the original version of the blob is available locally,
  63        outputs information about them to the standard output.
  64
  65-z::
  66        When showing the index information, do not munge paths,
  67        but use NUL terminated machine readable format.  Without
  68        this flag, the pathnames output will have TAB, LF, and
  69        backslash characters replaced with `\t`, `\n`, and `\\`,
  70        respectively.
  71
  72-p<n>::
  73        Remove <n> leading slashes from traditional diff paths. The
  74        default is 1.
  75
  76-C<n>::
  77        Ensure at least <n> lines of surrounding context match before
  78        and after each change.  When fewer lines of surrounding
  79        context exist they all most match.  By default no context is
  80        ever ignored.
  81
  82--apply::
  83        If you use any of the options marked ``Turns off
  84        "apply"'' above, git-apply reads and outputs the
  85        information you asked without actually applying the
  86        patch.  Give this flag after those flags to also apply
  87        the patch.
  88
  89--no-add::
  90        When applying a patch, ignore additions made by the
  91        patch.  This can be used to extract common part between
  92        two files by first running `diff` on them and applying
  93        the result with this option, which would apply the
  94        deletion part but not addition part.
  95
  96--allow-binary-replacement::
  97        When applying a patch, which is a git-enhanced patch
  98        that was prepared to record the pre- and post-image object
  99        name in full, and the path being patched exactly matches
 100        the object the patch applies to (i.e. "index" line's
 101        pre-image object name is what is in the working tree),
 102        and the post-image object is available in the object
 103        database, use the post-image object as the patch
 104        result.  This allows binary files to be patched in a
 105        very limited way.
 106
 107--whitespace=<option>::
 108        When applying a patch, detect a new or modified line
 109        that ends with trailing whitespaces (this includes a
 110        line that solely consists of whitespaces).  By default,
 111        the command outputs warning messages and applies the
 112        patch.
 113        When `git-apply` is used for statistics and not applying a
 114        patch, it defaults to `nowarn`.
 115        You can use different `<option>` to control this
 116        behaviour:
 117+
 118* `nowarn` turns off the trailing whitespace warning.
 119* `warn` outputs warnings for a few such errors, but applies the
 120  patch (default).
 121* `error` outputs warnings for a few such errors, and refuses
 122  to apply the patch.
 123* `error-all` is similar to `error` but shows all errors.
 124* `strip` outputs warnings for a few such errors, strips out the
 125  trailing whitespaces and applies the patch.
 126
 127
 128Configuration
 129-------------
 130
 131apply.whitespace::
 132        When no `--whitespace` flag is given from the command
 133        line, this configuration item is used as the default.
 134
 135
 136Author
 137------
 138Written by Linus Torvalds <torvalds@osdl.org>
 139
 140Documentation
 141--------------
 142Documentation by Junio C Hamano
 143
 144GIT
 145---
 146Part of the gitlink:git[7] suite
 147