b5c91f10b2e8cc2deabecfd70e2a412aba162478
[git.git] / man1 / git-apply.1
1 .\"Generated by db2man.xsl. Don't modify this, modify the source.
2 .de Sh \" Subsection
3 .br
4 .if t .Sp
5 .ne 5
6 .PP
7 \fB\\$1\fR
8 .PP
9 ..
10 .de Sp \" Vertical space (when we can't use .PP)
11 .if t .sp .5v
12 .if n .sp
13 ..
14 .de Ip \" List item
15 .br
16 .ie \\n(.$>=3 .ne \\$3
17 .el .ne 3
18 .IP "\\$1" \\$2
19 ..
20 .TH "GIT-APPLY" 1 "" "" ""
21 .SH NAME
22 git-apply \- Apply patch on a git index file and a work tree
23 .SH "SYNOPSIS"
24
25 .nf
26 \fIgit\-apply\fR [\-\-stat] [\-\-numstat] [\-\-summary] [\-\-check] [\-\-index] [\-\-apply]
27           [\-\-no\-add] [\-\-index\-info] [\-\-allow\-binary\-replacement] [\-z] [\-pNUM]
28           [\-\-whitespace=<nowarn|warn|error|error\-all|strip>]
29           [<patch>...]
30 .fi
31
32 .SH "DESCRIPTION"
33
34
35 Reads supplied diff output and applies it on a git index file and a work tree\&.
36
37 .SH "OPTIONS"
38
39 .TP
40 <patch>...
41 The files to read patch from\&. \fI\-\fR can be used to read from the standard input\&.
42
43 .TP
44 \-\-stat
45 Instead of applying the patch, output diffstat for the input\&. Turns off "apply"\&.
46
47 .TP
48 \-\-numstat
49 Similar to \-\-stat, but shows number of added and deleted lines in decimal notation and pathname without abbreviation, to make it more machine friendly\&. Turns off "apply"\&.
50
51 .TP
52 \-\-summary
53 Instead of applying the patch, output a condensed summary of information obtained from git diff extended headers, such as creations, renames and mode changes\&. Turns off "apply"\&.
54
55 .TP
56 \-\-check
57 Instead of applying the patch, see if the patch is applicable to the current work tree and/or the index file and detects errors\&. Turns off "apply"\&.
58
59 .TP
60 \-\-index
61 When \-\-check is in effect, or when applying the patch (which is the default when none of the options that disables it is in effect), make sure the patch is applicable to what the current index file records\&. If the file to be patched in the work tree is not up\-to\-date, it is flagged as an error\&. This flag also causes the index file to be updated\&.
62
63 .TP
64 \-\-index\-info
65 Newer git\-diff output has embedded \fIindex information\fR for each blob to help identify the original version that the patch applies to\&. When this flag is given, and if the original version of the blob is available locally, outputs information about them to the standard output\&.
66
67 .TP
68 \-z
69 When showing the index information, do not munge paths, but use NUL terminated machine readable format\&. Without this flag, the pathnames output will have TAB, LF, and backslash characters replaced with \\t, \\n, and \\\\, respectively\&.
70
71 .TP
72 \-p<n>
73 Remove <n> leading slashes from traditional diff paths\&. The default is 1\&.
74
75 .TP
76 \-\-apply
77 If you use any of the options marked “Turns off "apply"” above, git\-apply reads and outputs the information you asked without actually applying the patch\&. Give this flag after those flags to also apply the patch\&.
78
79 .TP
80 \-\-no\-add
81 When applying a patch, ignore additions made by the patch\&. This can be used to extract common part between two files by first running diff on them and applying the result with this option, which would apply the deletion part but not addition part\&.
82
83 .TP
84 \-\-allow\-binary\-replacement
85 When applying a patch, which is a git\-enhanced patch that was prepared to record the pre\- and post\-image object name in full, and the path being patched exactly matches the object the patch applies to (i\&.e\&. "index" line's pre\-image object name is what is in the working tree), and the post\-image object is available in the object database, use the post\-image object as the patch result\&. This allows binary files to be patched in a very limited way\&.
86
87 .TP
88 \-\-whitespace=<option>
89 When applying a patch, detect a new or modified line that ends with trailing whitespaces (this includes a line that solely consists of whitespaces)\&. By default, the command outputs warning messages and applies the patch\&. When git\-apply is used for statistics and not applying a patch, it defaults to nowarn\&. You can use different <option> to control this behaviour:
90
91 .RS
92 .TP 3
93 \(bu
94  nowarn turns off the trailing whitespace warning\&.
95 .TP
96 \(bu
97  warn outputs warnings for a few such errors, but applies the patch (default)\&.
98 .TP
99 \(bu
100  error outputs warnings for a few such errors, and refuses to apply the patch\&.
101 .TP
102 \(bu
103  error\-all is similar to error but shows all errors\&.
104 .TP
105 \(bu
106  strip outputs warnings for a few such errors, strips out the trailing whitespaces and applies the patch\&.
107 .LP
108 .RE
109 .IP
110
111 .SH "CONFIGURATION"
112
113 .TP
114 apply\&.whitespace
115 When no \-\-whitespace flag is given from the command line, this configuration item is used as the default\&.
116
117 .SH "AUTHOR"
118
119
120 Written by Linus Torvalds <torvalds@osdl\&.org>
121
122 .SH "DOCUMENTATION"
123
124
125 Documentation by Junio C Hamano
126
127 .SH "GIT"
128
129
130 Part of the \fBgit\fR(7) suite
131