]>
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 | -------- | |
011f4274 | 11 | 'git-apply' [--stat] [--numstat] [--summary] [--check] [--index] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [-z] [<patch>...] |
d0587fd5 JH |
12 | |
13 | DESCRIPTION | |
14 | ----------- | |
f73ae1fc | 15 | Reads supplied diff output and applies it on a git index file |
d0587fd5 JH |
16 | and a work tree. |
17 | ||
18 | OPTIONS | |
19 | ------- | |
12dd6e8c JH |
20 | <patch>...:: |
21 | The files to read patch from. '-' can be used to read | |
22 | from the standard input. | |
d0587fd5 | 23 | |
d0587fd5 JH |
24 | --stat:: |
25 | Instead of applying the patch, output diffstat for the | |
12dd6e8c | 26 | input. Turns off "apply". |
d0587fd5 | 27 | |
7d8b7c21 JH |
28 | --numstat:: |
29 | Similar to \--stat, but shows number of added and | |
30 | deleted lines in decimal notation and pathname without | |
31 | abbreviation, to make it more machine friendly. Turns | |
32 | off "apply". | |
33 | ||
d0587fd5 JH |
34 | --summary:: |
35 | Instead of applying the patch, output a condensed | |
36 | summary of information obtained from git diff extended | |
37 | headers, such as creations, renames and mode changes. | |
12dd6e8c | 38 | Turns off "apply". |
d0587fd5 JH |
39 | |
40 | --check:: | |
41 | Instead of applying the patch, see if the patch is | |
42 | applicable to the current work tree and/or the index | |
12dd6e8c | 43 | file and detects errors. Turns off "apply". |
d0587fd5 JH |
44 | |
45 | --index:: | |
46 | When --check is in effect, or when applying the patch | |
47 | (which is the default when none of the options that | |
48 | disables it is in effect), make sure the patch is | |
49 | applicable to what the current index file records. If | |
50 | the file to be patched in the work tree is not | |
51 | up-to-date, it is flagged as an error. This flag also | |
52 | causes the index file to be updated. | |
53 | ||
d88156e9 JH |
54 | --index-info:: |
55 | Newer git-diff output has embedded 'index information' | |
56 | for each blob to help identify the original version that | |
57 | the patch applies to. When this flag is given, and if | |
58 | the original version of the blob is available locally, | |
59 | outputs information about them to the standard output. | |
60 | ||
61 | -z:: | |
62 | When showing the index information, do not munge paths, | |
63 | but use NUL terminated machine readable format. Without | |
64 | this flag, the pathnames output will have TAB, LF, and | |
65 | backslash characters replaced with `\t`, `\n`, and `\\`, | |
66 | respectively. | |
67 | ||
12dd6e8c JH |
68 | --apply:: |
69 | If you use any of the options marked ``Turns off | |
70 | "apply"'' above, git-apply reads and outputs the | |
71 | information you asked without actually applying the | |
72 | patch. Give this flag after those flags to also apply | |
73 | the patch. | |
74 | ||
e433705d JH |
75 | --no-add:: |
76 | When applying a patch, ignore additions made by the | |
77 | patch. This can be used to extract common part between | |
78 | two files by first running `diff` on them and applying | |
79 | the result with this option, which would apply the | |
80 | deletion part but not addition part. | |
d0587fd5 | 81 | |
011f4274 JH |
82 | --allow-binary-replacement:: |
83 | When applying a patch, which is a git-enhanced patch | |
84 | that was prepared to record the pre- and post-image object | |
85 | name in full, and the path being patched exactly matches | |
86 | the object the patch applies to (i.e. "index" line's | |
87 | pre-image object name is what is in the working tree), | |
88 | and the post-image object is available in the object | |
89 | database, use the post-image object as the patch | |
90 | result. This allows binary files to be patched in a | |
91 | very limited way. | |
92 | ||
d0587fd5 JH |
93 | Author |
94 | ------ | |
95 | Written by Linus Torvalds <torvalds@osdl.org> | |
96 | ||
97 | Documentation | |
98 | -------------- | |
99 | Documentation by Junio C Hamano | |
100 | ||
101 | GIT | |
102 | --- | |
a7154e91 | 103 | Part of the gitlink:git[7] suite |
d0587fd5 | 104 |