]>
Commit | Line | Data |
---|---|---|
d0587fd5 JH |
1 | git-apply(1) |
2 | ============ | |
d0587fd5 JH |
3 | |
4 | NAME | |
5 | ---- | |
72e9340c | 6 | git-apply - Apply patch on a git index file and a work tree |
d0587fd5 JH |
7 | |
8 | ||
9 | SYNOPSIS | |
10 | -------- | |
353ce815 JF |
11 | [verse] |
12 | 'git-apply' [--stat] [--numstat] [--summary] [--check] [--index] [--apply] | |
13 | [--no-add] [--index-info] [--allow-binary-replacement] [-z] | |
14 | [<patch>...] | |
d0587fd5 JH |
15 | |
16 | DESCRIPTION | |
17 | ----------- | |
f73ae1fc | 18 | Reads supplied diff output and applies it on a git index file |
d0587fd5 JH |
19 | and a work tree. |
20 | ||
21 | OPTIONS | |
22 | ------- | |
12dd6e8c JH |
23 | <patch>...:: |
24 | The files to read patch from. '-' can be used to read | |
25 | from the standard input. | |
d0587fd5 | 26 | |
d0587fd5 JH |
27 | --stat:: |
28 | Instead of applying the patch, output diffstat for the | |
12dd6e8c | 29 | input. Turns off "apply". |
d0587fd5 | 30 | |
7d8b7c21 JH |
31 | --numstat:: |
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 | |
35 | off "apply". | |
36 | ||
d0587fd5 JH |
37 | --summary:: |
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. | |
12dd6e8c | 41 | Turns off "apply". |
d0587fd5 JH |
42 | |
43 | --check:: | |
44 | Instead of applying the patch, see if the patch is | |
45 | applicable to the current work tree and/or the index | |
12dd6e8c | 46 | file and detects errors. Turns off "apply". |
d0587fd5 JH |
47 | |
48 | --index:: | |
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. | |
56 | ||
d88156e9 JH |
57 | --index-info:: |
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. | |
63 | ||
64 | -z:: | |
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 `\\`, | |
69 | respectively. | |
70 | ||
12dd6e8c JH |
71 | --apply:: |
72 | If you use any of the options marked ``Turns off | |
73 | "apply"'' above, git-apply reads and outputs the | |
74 | information you asked without actually applying the | |
75 | patch. Give this flag after those flags to also apply | |
76 | the patch. | |
77 | ||
e433705d JH |
78 | --no-add:: |
79 | When applying a patch, ignore additions made by the | |
80 | patch. This can be used to extract common part between | |
81 | two files by first running `diff` on them and applying | |
82 | the result with this option, which would apply the | |
83 | deletion part but not addition part. | |
d0587fd5 | 84 | |
27dedf0c JH |
85 | --allow-binary-replacement:: |
86 | When applying a patch, which is a git-enhanced patch | |
87 | that was prepared to record the pre- and post-image object | |
88 | name in full, and the path being patched exactly matches | |
89 | the object the patch applies to (i.e. "index" line's | |
90 | pre-image object name is what is in the working tree), | |
91 | and the post-image object is available in the object | |
92 | database, use the post-image object as the patch | |
93 | result. This allows binary files to be patched in a | |
94 | very limited way. | |
95 | ||
d0587fd5 JH |
96 | Author |
97 | ------ | |
98 | Written by Linus Torvalds <torvalds@osdl.org> | |
99 | ||
100 | Documentation | |
101 | -------------- | |
102 | Documentation by Junio C Hamano | |
103 | ||
104 | GIT | |
105 | --- | |
a7154e91 | 106 | Part of the gitlink:git[7] suite |
d0587fd5 | 107 |