Documentation / git-apply.txton commit annotate: Support annotation of files on other revisions. (5fcab3d)
   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          [--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--apply::
  77        If you use any of the options marked ``Turns off
  78        "apply"'' above, git-apply reads and outputs the
  79        information you asked without actually applying the
  80        patch.  Give this flag after those flags to also apply
  81        the patch.
  82
  83--no-add::
  84        When applying a patch, ignore additions made by the
  85        patch.  This can be used to extract common part between
  86        two files by first running `diff` on them and applying
  87        the result with this option, which would apply the
  88        deletion part but not addition part.
  89
  90--allow-binary-replacement::
  91        When applying a patch, which is a git-enhanced patch
  92        that was prepared to record the pre- and post-image object
  93        name in full, and the path being patched exactly matches
  94        the object the patch applies to (i.e. "index" line's
  95        pre-image object name is what is in the working tree),
  96        and the post-image object is available in the object
  97        database, use the post-image object as the patch
  98        result.  This allows binary files to be patched in a
  99        very limited way.
 100
 101--whitespace=<option>::
 102        When applying a patch, detect a new or modified line
 103        that ends with trailing whitespaces (this includes a
 104        line that solely consists of whitespaces).  By default,
 105        the command outputs warning messages and applies the
 106        patch.
 107        When `git-apply` is used for statistics and not applying a
 108        patch, it defaults to `nowarn`.
 109        You can use different `<option>` to control this
 110        behaviour:
 111+
 112* `nowarn` turns off the trailing whitespace warning.
 113* `warn` outputs warnings for a few such errors, but applies the
 114  patch (default).
 115* `error` outputs warnings for a few such errors, and refuses
 116  to apply the patch.
 117* `error-all` is similar to `error` but shows all errors.
 118* `strip` outputs warnings for a few such errors, strips out the
 119  trailing whitespaces and applies the patch.
 120
 121
 122Configuration
 123-------------
 124
 125apply.whitespace::
 126        When no `--whitespace` flag is given from the command
 127        line, this configuration item is used as the default.
 128
 129
 130Author
 131------
 132Written by Linus Torvalds <torvalds@osdl.org>
 133
 134Documentation
 135--------------
 136Documentation by Junio C Hamano
 137
 138GIT
 139---
 140Part of the gitlink:git[7] suite
 141