6 git-apply - Apply patch on a git index file and a work tree
12 'git-apply' [--stat] [--numstat] [--summary] [--check] [--index] [--apply]
13 [--no-add] [--index-info] [--allow-binary-replacement] [-z] [-pNUM]
18 Reads supplied diff output and applies it on a git index file
24 The files to read patch from. '-' can be used to read
25 from the standard input.
28 Instead of applying the patch, output diffstat for the
29 input. Turns off "apply".
32 Similar to \--stat, but shows number of added and
33 deleted lines in decimal notation and pathname without
34 abbreviation, to make it more machine friendly. Turns
38 Instead of applying the patch, output a condensed
39 summary of information obtained from git diff extended
40 headers, such as creations, renames and mode changes.
44 Instead of applying the patch, see if the patch is
45 applicable to the current work tree and/or the index
46 file and detects errors. Turns off "apply".
49 When --check is in effect, or when applying the patch
50 (which is the default when none of the options that
51 disables it is in effect), make sure the patch is
52 applicable to what the current index file records. If
53 the file to be patched in the work tree is not
54 up-to-date, it is flagged as an error. This flag also
55 causes the index file to be updated.
58 Newer git-diff output has embedded 'index information'
59 for each blob to help identify the original version that
60 the patch applies to. When this flag is given, and if
61 the original version of the blob is available locally,
62 outputs information about them to the standard output.
65 When showing the index information, do not munge paths,
66 but use NUL terminated machine readable format. Without
67 this flag, the pathnames output will have TAB, LF, and
68 backslash characters replaced with `\t`, `\n`, and `\\`,
72 Remove <n> leading slashes from traditional diff paths. The
76 If you use any of the options marked ``Turns off
77 "apply"'' above, git-apply reads and outputs the
78 information you asked without actually applying the
79 patch. Give this flag after those flags to also apply
83 When applying a patch, ignore additions made by the
84 patch. This can be used to extract common part between
85 two files by first running `diff` on them and applying
86 the result with this option, which would apply the
87 deletion part but not addition part.
89 --allow-binary-replacement::
90 When applying a patch, which is a git-enhanced patch
91 that was prepared to record the pre- and post-image object
92 name in full, and the path being patched exactly matches
93 the object the patch applies to (i.e. "index" line's
94 pre-image object name is what is in the working tree),
95 and the post-image object is available in the object
96 database, use the post-image object as the patch
97 result. This allows binary files to be patched in a
102 Written by Linus Torvalds <torvalds@osdl.org>
106 Documentation by Junio C Hamano
110 Part of the gitlink:git[7] suite