blob: 13cdd7f3b636dfadc262dcf099653775ec53cd5a [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-am(1)
2=========
3
4NAME
5----
Junio C Hamano7c73c662007-01-19 00:37:506git-am - Apply a series of patches from a mailbox
Junio C Hamano1a4e8412005-12-27 08:17:237
8
9SYNOPSIS
10--------
Junio C Hamano235a91e2006-01-07 01:13:5811[verse]
Junio C Hamano3d1b5a12013-05-17 23:34:0212'git am' [--signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8]
Junio C Hamano9c512872015-08-12 21:59:2513 [--[no-]3way] [--interactive] [--committer-date-is-author-date]
Junio C Hamanofe24db02009-08-22 05:10:4714 [--ignore-date] [--ignore-space-change | --ignore-whitespace]
Junio C Hamanocc0cb312009-01-22 03:38:5015 [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
Junio C Hamano0c1b64e2012-04-20 23:50:4916 [--exclude=<path>] [--include=<path>] [--reject] [-q | --quiet]
Junio C Hamano3214e5f2014-03-25 19:54:3817 [--[no-]scissors] [-S[<keyid>]] [--patch-format=<format>]
Junio C Hamanod2179ef2010-10-22 04:12:1718 [(<mbox> | <Maildir>)...]
Junio C Hamanob2628b12010-02-12 08:08:0819'git am' (--continue | --skip | --abort)
Junio C Hamano1a4e8412005-12-27 08:17:2320
21DESCRIPTION
22-----------
23Splits mail messages in a mailbox into commit log message,
24authorship information and patches, and applies them to the
25current branch.
26
27OPTIONS
28-------
Junio C Hamanod2179ef2010-10-22 04:12:1729(<mbox>|<Maildir>)...::
Junio C Hamano9cb74f22007-02-12 04:15:0530The list of mailbox files to read patches from. If you do not
Junio C Hamano7924d5e2009-03-03 08:28:4831supply this argument, the command reads from the standard input.
32If you supply directories, they will be treated as Maildirs.
Junio C Hamano9cb74f22007-02-12 04:15:0533
Junio C Hamanoeb415992008-06-08 22:49:4734-s::
35--signoff::
Junio C Hamano86f31572009-05-06 07:38:4236Add a `Signed-off-by:` line to the commit message, using
Junio C Hamano1a4e8412005-12-27 08:17:2337the committer identity of yourself.
Junio C Hamano4e6ba272016-01-20 23:23:1938See the signoff option in linkgit:git-commit[1] for more information.
Junio C Hamano1a4e8412005-12-27 08:17:2339
Junio C Hamanoeb415992008-06-08 22:49:4740-k::
41--keep::
Junio C Hamano1aa40d22010-01-21 17:46:4342Pass `-k` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).
Junio C Hamano1d3a6c72007-01-09 11:13:4743
Junio C Hamanob5be0522012-01-29 22:20:1944--keep-non-patch::
45Pass `-b` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).
46
Junio C Hamano3d1b5a12013-05-17 23:34:0247--[no-]keep-cr::
Junio C Hamanocaa712a2010-03-11 01:17:3548With `--keep-cr`, call 'git mailsplit' (see linkgit:git-mailsplit[1])
49with the same option, to prevent it from stripping CR at the end of
50lines. `am.keepcr` configuration variable can be used to specify the
51default behaviour. `--no-keep-cr` is useful to override `am.keepcr`.
52
Junio C Hamanoc28068f2009-09-08 00:55:2353-c::
54--scissors::
55Remove everything in body before a scissors line (see
Junio C Hamano7f1bc9d2015-03-05 22:38:2656linkgit:git-mailinfo[1]). Can be activated by default using
57the `mailinfo.scissors` configuration variable.
Junio C Hamanoc28068f2009-09-08 00:55:2358
Junio C Hamano01f1fbd2010-03-05 07:36:4159--no-scissors::
Junio C Hamanocf5b7732009-09-11 23:28:3260Ignore scissors lines (see linkgit:git-mailinfo[1]).
61
Junio C Hamano6df93d92014-12-22 22:48:0962-m::
63--message-id::
64Pass the `-m` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]),
65so that the Message-ID header is added to the commit message.
66The `am.messageid` configuration variable can be used to specify
67the default behaviour.
68
69--no-message-id::
70Do not add the Message-ID header to the commit message.
71`no-message-id` is useful to override `am.messageid`.
72
Junio C Hamano2c14c8d2009-07-02 03:17:0073-q::
74--quiet::
75Be quiet. Only print error messages.
76
Junio C Hamanoeb415992008-06-08 22:49:4777-u::
78--utf8::
Junio C Hamano1aa40d22010-01-21 17:46:4379Pass `-u` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).
Junio C Hamano1d3a6c72007-01-09 11:13:4780The proposed commit log message taken from the e-mail
Junio C Hamano0430e3a2007-05-15 03:13:1781is re-coded into UTF-8 encoding (configuration variable
Junio C Hamano1d3a6c72007-01-09 11:13:4782`i18n.commitencoding` can be used to specify project's
83preferred encoding if it is not UTF-8).
84+
85This was optional in prior versions of git, but now it is the
Junio C Hamano7924d5e2009-03-03 08:28:4886default. You can use `--no-utf8` to override this.
Junio C Hamano1d3a6c72007-01-09 11:13:4787
88--no-utf8::
Junio C Hamano1aa40d22010-01-21 17:46:4389Pass `-n` flag to 'git mailinfo' (see
Junio C Hamano35738e82008-01-07 07:55:4690linkgit:git-mailinfo[1]).
Junio C Hamano1a4e8412005-12-27 08:17:2391
Junio C Hamanoeb415992008-06-08 22:49:4792-3::
93--3way::
Junio C Hamano9c512872015-08-12 21:59:2594--no-3way::
Junio C Hamano1a4e8412005-12-27 08:17:2395When the patch does not apply cleanly, fall back on
Junio C Hamano7924d5e2009-03-03 08:28:48963-way merge if the patch records the identity of blobs
97it is supposed to apply to and we have those blobs
Junio C Hamano9c512872015-08-12 21:59:2598available locally. `--no-3way` can be used to override
99am.threeWay configuration variable. For more information,
100see am.threeWay in linkgit:git-config[1].
Junio C Hamano0430e3a2007-05-15 03:13:17101
Junio C Hamanofe24db02009-08-22 05:10:47102--ignore-space-change::
103--ignore-whitespace::
Junio C Hamano0430e3a2007-05-15 03:13:17104--whitespace=<option>::
Junio C Hamanoeb415992008-06-08 22:49:47105-C<n>::
106-p<n>::
Junio C Hamanocc0cb312009-01-22 03:38:50107--directory=<dir>::
Junio C Hamanodac21e72011-08-19 06:50:43108--exclude=<path>::
Junio C Hamano0c1b64e2012-04-20 23:50:49109--include=<path>::
Junio C Hamano22bcc112009-01-24 08:05:18110--reject::
Junio C Hamano1aa40d22010-01-21 17:46:43111These flags are passed to the 'git apply' (see linkgit:git-apply[1])
Junio C Hamano0430e3a2007-05-15 03:13:17112program that applies
113the patch.
114
Junio C Hamano3214e5f2014-03-25 19:54:38115--patch-format::
116By default the command will try to detect the patch format
117automatically. This option allows the user to bypass the automatic
118detection and specify the patch format that the patch(es) should be
119interpreted as. Valid formats are mbox, stgit, stgit-series and hg.
120
Junio C Hamanoeb415992008-06-08 22:49:47121-i::
122--interactive::
Junio C Hamano0430e3a2007-05-15 03:13:17123Run interactively.
Junio C Hamano1a4e8412005-12-27 08:17:23124
Junio C Hamanoa3bb6eb2009-02-05 01:26:33125--committer-date-is-author-date::
126By default the command records the date from the e-mail
127message as the commit author date, and uses the time of
128commit creation as the committer date. This allows the
129user to lie about the committer date by using the same
Junio C Hamano86f31572009-05-06 07:38:42130value as the author date.
Junio C Hamanoa3bb6eb2009-02-05 01:26:33131
132--ignore-date::
133By default the command records the date from the e-mail
134message as the commit author date, and uses the time of
135commit creation as the committer date. This allows the
Junio C Hamano86f31572009-05-06 07:38:42136user to lie about the author date by using the same
137value as the committer date.
Junio C Hamanoa3bb6eb2009-02-05 01:26:33138
Junio C Hamano1a4e8412005-12-27 08:17:23139--skip::
140Skip the current patch. This is only meaningful when
141restarting an aborted patch.
142
Junio C Hamano5b3533d2014-02-27 23:07:15143-S[<keyid>]::
144--gpg-sign[=<keyid>]::
Junio C Hamano1eb56092015-10-05 20:39:53145GPG-sign commits. The `keyid` argument is optional and
146defaults to the committer identity; if specified, it must be
147stuck to the option without a space.
Junio C Hamano5b3533d2014-02-27 23:07:15148
Junio C Hamanob2628b12010-02-12 08:08:08149--continue::
Junio C Hamanoeb415992008-06-08 22:49:47150-r::
151--resolved::
Junio C Hamano1a4e8412005-12-27 08:17:23152After a patch failure (e.g. attempting to apply
153conflicting patch), the user has applied it by hand and
154the index file stores the result of the application.
155Make a commit using the authorship and commit log
156extracted from the e-mail message and the current index
157file, and continue.
158
Junio C Hamano0e3cb532007-04-17 08:28:11159--resolvemsg=<msg>::
160When a patch failure occurs, <msg> will be printed
161to the screen before exiting. This overrides the
Junio C Hamanoa1952302013-07-01 21:31:18162standard message informing you to use `--continue`
Junio C Hamano0e3cb532007-04-17 08:28:11163or `--skip` to handle the failure. This is solely
Junio C Hamano1aa40d22010-01-21 17:46:43164for internal use between 'git rebase' and 'git am'.
Junio C Hamano0e3cb532007-04-17 08:28:11165
Junio C Hamano5ba2c222008-07-21 04:33:46166--abort::
167Restore the original branch and abort the patching operation.
168
Junio C Hamano1a4e8412005-12-27 08:17:23169DISCUSSION
170----------
171
Junio C Hamano35e57552007-03-25 07:54:35172The commit author name is taken from the "From: " line of the
Junio C Hamano86f31572009-05-06 07:38:42173message, and commit author date is taken from the "Date: " line
Junio C Hamano35e57552007-03-25 07:54:35174of the message. The "Subject: " line is used as the title of
175the commit, after stripping common prefix "[PATCH <anything>]".
Junio C Hamano86f31572009-05-06 07:38:42176The "Subject: " line is supposed to concisely describe what the
177commit is about in one line of text.
Junio C Hamano35e57552007-03-25 07:54:35178
Junio C Hamanoc28068f2009-09-08 00:55:23179"From: " and "Subject: " lines starting the body override the respective
180commit author name and title values taken from the headers.
Junio C Hamano35e57552007-03-25 07:54:35181
182The commit message is formed by the title taken from the
183"Subject: ", a blank line and the body of the message up to
Junio C Hamano86f31572009-05-06 07:38:42184where the patch begins. Excess whitespace at the end of each
185line is automatically stripped.
Junio C Hamano35e57552007-03-25 07:54:35186
187The patch is expected to be inline, directly following the
Junio C Hamano7924d5e2009-03-03 08:28:48188message. Any line that is of the form:
Junio C Hamano35e57552007-03-25 07:54:35189
190* three-dashes and end-of-line, or
191* a line that begins with "diff -", or
192* a line that begins with "Index: "
193
194is taken as the beginning of a patch, and the commit log message
195is terminated before the first occurrence of such a line.
196
Junio C Hamano86f31572009-05-06 07:38:42197When initially invoking `git am`, you give it the names of the mailboxes
Junio C Hamano7924d5e2009-03-03 08:28:48198to process. Upon seeing the first patch that does not apply, it
199aborts in the middle. You can recover from this in one of two ways:
Junio C Hamano1a4e8412005-12-27 08:17:23200
Junio C Hamano7924d5e2009-03-03 08:28:48201. skip the current patch by re-running the command with the '--skip'
Junio C Hamano1a4e8412005-12-27 08:17:23202 option.
203
204. hand resolve the conflict in the working directory, and update
Junio C Hamano7924d5e2009-03-03 08:28:48205 the index file to bring it into a state that the patch should
Junio C Hamanoa1952302013-07-01 21:31:18206 have produced. Then run the command with the '--continue' option.
Junio C Hamano1a4e8412005-12-27 08:17:23207
Junio C Hamano78f25df2011-03-23 00:05:35208The command refuses to process new mailboxes until the current
209operation is finished, so if you decide to start over from scratch,
210run `git am --abort` before running the command with mailbox
Junio C Hamano1a4e8412005-12-27 08:17:23211names.
212
Junio C Hamano38ddcce2008-07-15 15:49:03213Before any patches are applied, ORIG_HEAD is set to the tip of the
214current branch. This is useful if you have problems with multiple
215commits, like running 'git am' on the wrong branch or an error in the
216commits that is more easily fixed by changing the mailbox (e.g.
217errors in the "From:" lines).
218
Junio C Hamano81703b22014-03-14 22:00:27219HOOKS
220-----
221This command can run `applypatch-msg`, `pre-applypatch`,
222and `post-applypatch` hooks. See linkgit:githooks[5] for more
223information.
Junio C Hamano1a4e8412005-12-27 08:17:23224
225SEE ALSO
226--------
Junio C Hamano35738e82008-01-07 07:55:46227linkgit:git-apply[1].
Junio C Hamano1a4e8412005-12-27 08:17:23228
Junio C Hamano1a4e8412005-12-27 08:17:23229GIT
230---
Junio C Hamanof7c042d2008-06-06 22:50:53231Part of the linkgit:git[1] suite