fd3db6531d71e7fb621765c0387c067cd11491a3
[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           [\-CNUM] [\-\-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 \-C<n>
77 Ensure at least <n> lines of surrounding context match before and after each change\&. When fewer lines of surrounding context exist they all most match\&. By default no context is ever ignored\&.
78
79 .TP
80 \-\-apply
81 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\&.
82
83 .TP
84 \-\-no\-add
85 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\&.
86
87 .TP
88 \-\-allow\-binary\-replacement
89 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\&.
90
91 .TP
92 \-\-whitespace=<option>
93 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 behavior:
94
95 .RS
96 .TP 3
97 \(bu
98  nowarn turns off the trailing whitespace warning\&.
99 .TP
100 \(bu
101  warn outputs warnings for a few such errors, but applies the patch (default)\&.
102 .TP
103 \(bu
104  error outputs warnings for a few such errors, and refuses to apply the patch\&.
105 .TP
106 \(bu
107  error\-all is similar to error but shows all errors\&.
108 .TP
109 \(bu
110  strip outputs warnings for a few such errors, strips out the trailing whitespaces and applies the patch\&.
111 .LP
112 .RE
113 .IP
114
115 .SH "CONFIGURATION"
116
117 .TP
118 apply\&.whitespace
119 When no \-\-whitespace flag is given from the command line, this configuration item is used as the default\&.
120
121 .SH "AUTHOR"
122
123
124 Written by Linus Torvalds <torvalds@osdl\&.org>
125
126 .SH "DOCUMENTATION"
127
128
129 Documentation by Junio C Hamano
130
131 .SH "GIT"
132
133
134 Part of the \fBgit\fR(7) suite
135