Merge branch 'jc/mailinfo-scissors'
[git.git] / Documentation / git-am.txt
blob87781f4a7789c8cc9be03e77b0cfe37b13c6e9c0
1 git-am(1)
2 =========
4 NAME
5 ----
6 git-am - Apply a series of patches from a mailbox
9 SYNOPSIS
10 --------
11 [verse]
12 'git am' [--signoff] [--keep] [--utf8 | --no-utf8]
13          [--3way] [--interactive] [--committer-date-is-author-date]
14          [--ignore-date] [--ignore-space-change | --ignore-whitespace]
15          [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
16          [--reject] [-q | --quiet] [--scissors]
17          [<mbox> | <Maildir>...]
18 'git am' (--skip | --resolved | --abort)
20 DESCRIPTION
21 -----------
22 Splits mail messages in a mailbox into commit log message,
23 authorship information and patches, and applies them to the
24 current branch.
26 OPTIONS
27 -------
28 <mbox>|<Maildir>...::
29         The list of mailbox files to read patches from. If you do not
30         supply this argument, the command reads from the standard input.
31         If you supply directories, they will be treated as Maildirs.
33 -s::
34 --signoff::
35         Add a `Signed-off-by:` line to the commit message, using
36         the committer identity of yourself.
38 -k::
39 --keep::
40         Pass `-k` flag to 'git-mailinfo' (see linkgit:git-mailinfo[1]).
42 -c::
43 --scissors::
44         Remove everything in body before a scissors line (see
45         linkgit:git-mailinfo[1]).
47 -q::
48 --quiet::
49         Be quiet. Only print error messages.
51 -u::
52 --utf8::
53         Pass `-u` flag to 'git-mailinfo' (see linkgit:git-mailinfo[1]).
54         The proposed commit log message taken from the e-mail
55         is re-coded into UTF-8 encoding (configuration variable
56         `i18n.commitencoding` can be used to specify project's
57         preferred encoding if it is not UTF-8).
59 This was optional in prior versions of git, but now it is the
60 default.   You can use `--no-utf8` to override this.
62 --no-utf8::
63         Pass `-n` flag to 'git-mailinfo' (see
64         linkgit:git-mailinfo[1]).
66 -3::
67 --3way::
68         When the patch does not apply cleanly, fall back on
69         3-way merge if the patch records the identity of blobs
70         it is supposed to apply to and we have those blobs
71         available locally.
73 --ignore-date::
74 --ignore-space-change::
75 --ignore-whitespace::
76 --whitespace=<option>::
77 -C<n>::
78 -p<n>::
79 --directory=<dir>::
80 --reject::
81         These flags are passed to the 'git-apply' (see linkgit:git-apply[1])
82         program that applies
83         the patch.
85 -i::
86 --interactive::
87         Run interactively.
89 --committer-date-is-author-date::
90         By default the command records the date from the e-mail
91         message as the commit author date, and uses the time of
92         commit creation as the committer date. This allows the
93         user to lie about the committer date by using the same
94         value as the author date.
96 --ignore-date::
97         By default the command records the date from the e-mail
98         message as the commit author date, and uses the time of
99         commit creation as the committer date. This allows the
100         user to lie about the author date by using the same
101         value as the committer date.
103 --skip::
104         Skip the current patch.  This is only meaningful when
105         restarting an aborted patch.
107 -r::
108 --resolved::
109         After a patch failure (e.g. attempting to apply
110         conflicting patch), the user has applied it by hand and
111         the index file stores the result of the application.
112         Make a commit using the authorship and commit log
113         extracted from the e-mail message and the current index
114         file, and continue.
116 --resolvemsg=<msg>::
117         When a patch failure occurs, <msg> will be printed
118         to the screen before exiting.  This overrides the
119         standard message informing you to use `--resolved`
120         or `--skip` to handle the failure.  This is solely
121         for internal use between 'git-rebase' and 'git-am'.
123 --abort::
124         Restore the original branch and abort the patching operation.
126 DISCUSSION
127 ----------
129 The commit author name is taken from the "From: " line of the
130 message, and commit author date is taken from the "Date: " line
131 of the message.  The "Subject: " line is used as the title of
132 the commit, after stripping common prefix "[PATCH <anything>]".
133 The "Subject: " line is supposed to concisely describe what the
134 commit is about in one line of text.
136 "From: " and "Subject: " lines starting the body override the respective
137 commit author name and title values taken from the headers.
139 The commit message is formed by the title taken from the
140 "Subject: ", a blank line and the body of the message up to
141 where the patch begins.  Excess whitespace at the end of each
142 line is automatically stripped.
144 The patch is expected to be inline, directly following the
145 message.  Any line that is of the form:
147 * three-dashes and end-of-line, or
148 * a line that begins with "diff -", or
149 * a line that begins with "Index: "
151 is taken as the beginning of a patch, and the commit log message
152 is terminated before the first occurrence of such a line.
154 When initially invoking `git am`, you give it the names of the mailboxes
155 to process.  Upon seeing the first patch that does not apply, it
156 aborts in the middle.  You can recover from this in one of two ways:
158 . skip the current patch by re-running the command with the '--skip'
159   option.
161 . hand resolve the conflict in the working directory, and update
162   the index file to bring it into a state that the patch should
163   have produced.  Then run the command with the '--resolved' option.
165 The command refuses to process new mailboxes while the `.git/rebase-apply`
166 directory exists, so if you decide to start over from scratch,
167 run `rm -f -r .git/rebase-apply` before running the command with mailbox
168 names.
170 Before any patches are applied, ORIG_HEAD is set to the tip of the
171 current branch.  This is useful if you have problems with multiple
172 commits, like running 'git am' on the wrong branch or an error in the
173 commits that is more easily fixed by changing the mailbox (e.g.
174 errors in the "From:" lines).
177 SEE ALSO
178 --------
179 linkgit:git-apply[1].
182 Author
183 ------
184 Written by Junio C Hamano <gitster@pobox.com>
186 Documentation
187 --------------
188 Documentation by Petr Baudis, Junio C Hamano and the git-list <git@vger.kernel.org>.
192 Part of the linkgit:git[1] suite