Documentation / git-apply.txton commit Assorted typo fixes (3dff537)
   1git-apply(1)
   2============
   3
   4NAME
   5----
   6git-apply - Apply a patch on a git index file and a working tree
   7
   8
   9SYNOPSIS
  10--------
  11[verse]
  12'git-apply' [--stat] [--numstat] [--summary] [--check] [--index] [--apply]
  13          [--no-add] [--index-info] [--allow-binary-replacement | --binary]
  14          [-R | --reverse] [--reject] [-z] [-pNUM] [-CNUM] [--inaccurate-eof]
  15          [--whitespace=<nowarn|warn|error|error-all|strip>] [--exclude=PATH]
  16          [--cached] [--verbose] [<patch>...]
  17
  18DESCRIPTION
  19-----------
  20Reads supplied diff output and applies it on a git index file
  21and a work tree.
  22
  23OPTIONS
  24-------
  25<patch>...::
  26        The files to read patch from.  '-' can be used to read
  27        from the standard input.
  28
  29--stat::
  30        Instead of applying the patch, output diffstat for the
  31        input.  Turns off "apply".
  32
  33--numstat::
  34        Similar to \--stat, but shows number of added and
  35        deleted lines in decimal notation and pathname without
  36        abbreviation, to make it more machine friendly.  For
  37        binary files, outputs two `-` instead of saying
  38        `0 0`.  Turns off "apply".
  39
  40--summary::
  41        Instead of applying the patch, output a condensed
  42        summary of information obtained from git diff extended
  43        headers, such as creations, renames and mode changes.
  44        Turns off "apply".
  45
  46--check::
  47        Instead of applying the patch, see if the patch is
  48        applicable to the current work tree and/or the index
  49        file and detects errors.  Turns off "apply".
  50
  51--index::
  52        When --check is in effect, or when applying the patch
  53        (which is the default when none of the options that
  54        disables it is in effect), make sure the patch is
  55        applicable to what the current index file records.  If
  56        the file to be patched in the work tree is not
  57        up-to-date, it is flagged as an error.  This flag also
  58        causes the index file to be updated.
  59
  60--cached::
  61        Apply a patch without touching the working tree. Instead, take the
  62        cached data, apply the patch, and store the result in the index,
  63        without using the working tree. This implies '--index'.
  64
  65--index-info::
  66        Newer git-diff output has embedded 'index information'
  67        for each blob to help identify the original version that
  68        the patch applies to.  When this flag is given, and if
  69        the original version of the blob is available locally,
  70        outputs information about them to the standard output.
  71
  72-R, --reverse::
  73        Apply the patch in reverse.
  74
  75--reject::
  76        For atomicity, gitlink:git-apply[1] by default fails the whole patch and
  77        does not touch the working tree when some of the hunks
  78        do not apply.  This option makes it apply
  79        the parts of the patch that are applicable, and leave the
  80        rejected hunks in corresponding *.rej files.
  81
  82-z::
  83        When showing the index information, do not munge paths,
  84        but use NUL terminated machine readable format.  Without
  85        this flag, the pathnames output will have TAB, LF, and
  86        backslash characters replaced with `\t`, `\n`, and `\\`,
  87        respectively.
  88
  89-p<n>::
  90        Remove <n> leading slashes from traditional diff paths. The
  91        default is 1.
  92
  93-C<n>::
  94        Ensure at least <n> lines of surrounding context match before
  95        and after each change.  When fewer lines of surrounding
  96        context exist they all must match.  By default no context is
  97        ever ignored.
  98
  99--unidiff-zero::
 100        By default, gitlink:git-apply[1] expects that the patch being
 101        applied is a unified diff with at least one line of context.
 102        This provides good safety measures, but breaks down when
 103        applying a diff generated with --unified=0. To bypass these
 104        checks use '--unidiff-zero'.
 105+
 106Note, for the reasons stated above usage of context-free patches are
 107discouraged.
 108
 109--apply::
 110        If you use any of the options marked "Turns off
 111        'apply'" above, gitlink:git-apply[1] reads and outputs the
 112        information you asked without actually applying the
 113        patch.  Give this flag after those flags to also apply
 114        the patch.
 115
 116--no-add::
 117        When applying a patch, ignore additions made by the
 118        patch.  This can be used to extract common part between
 119        two files by first running `diff` on them and applying
 120        the result with this option, which would apply the
 121        deletion part but not addition part.
 122
 123--allow-binary-replacement, --binary::
 124        Historically we did not allow binary patch applied
 125        without an explicit permission from the user, and this
 126        flag was the way to do so.  Currently we always allow binary
 127        patch application, so this is a no-op.
 128
 129--exclude=<path-pattern>::
 130        Don't apply changes to files matching the given path pattern. This can
 131        be useful when importing patchsets, where you want to exclude certain
 132        files or directories.
 133
 134--whitespace=<option>::
 135        When applying a patch, detect a new or modified line
 136        that ends with trailing whitespaces (this includes a
 137        line that solely consists of whitespaces).  By default,
 138        the command outputs warning messages and applies the
 139        patch.
 140        When gitlink:git-apply[1] is used for statistics and not applying a
 141        patch, it defaults to `nowarn`.
 142        You can use different `<option>` to control this
 143        behavior:
 144+
 145* `nowarn` turns off the trailing whitespace warning.
 146* `warn` outputs warnings for a few such errors, but applies the
 147  patch (default).
 148* `error` outputs warnings for a few such errors, and refuses
 149  to apply the patch.
 150* `error-all` is similar to `error` but shows all errors.
 151* `strip` outputs warnings for a few such errors, strips out the
 152  trailing whitespaces and applies the patch.
 153
 154--inaccurate-eof::
 155        Under certain circumstances, some versions of diff do not correctly
 156        detect a missing new-line at the end of the file. As a result, patches
 157        created by such diff programs do not record incomplete lines
 158        correctly. This option adds support for applying such patches by
 159        working around this bug.
 160
 161--verbose::
 162        Report progress to stderr. By default, only a message about the
 163        current patch being applied will be printed. This option will cause
 164        additional information to be reported.
 165
 166Configuration
 167-------------
 168
 169apply.whitespace::
 170        When no `--whitespace` flag is given from the command
 171        line, this configuration item is used as the default.
 172
 173
 174Author
 175------
 176Written by Linus Torvalds <torvalds@osdl.org>
 177
 178Documentation
 179--------------
 180Documentation by Junio C Hamano
 181
 182GIT
 183---
 184Part of the gitlink:git[7] suite
 185