1GIT-AM(1)                         Git Manual                         GIT-AM(1)
2
3
4

NAME

6       git-am - Apply a series of patches from a mailbox
7

SYNOPSIS

9       git am [--signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8]
10                [--[no-]3way] [--interactive] [--committer-date-is-author-date]
11                [--ignore-date] [--ignore-space-change | --ignore-whitespace]
12                [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
13                [--exclude=<path>] [--include=<path>] [--reject] [-q | --quiet]
14                [--[no-]scissors] [-S[<keyid>]] [--patch-format=<format>]
15                [--quoted-cr=<action>]
16                [--empty=(stop|drop|keep)]
17                [(<mbox> | <Maildir>)...]
18       git am (--continue | --skip | --abort | --quit | --show-current-patch[=(diff|raw)] | --allow-empty)
19

DESCRIPTION

21       Splits mail messages in a mailbox into commit log message, authorship
22       information and patches, and applies them to the current branch.
23

OPTIONS

25       (<mbox>|<Maildir>)...
26           The list of mailbox files to read patches from. If you do not
27           supply this argument, the command reads from the standard input. If
28           you supply directories, they will be treated as Maildirs.
29
30       -s, --signoff
31           Add a Signed-off-by trailer to the commit message, using the
32           committer identity of yourself. See the signoff option in git-
33           commit(1) for more information.
34
35       -k, --keep
36           Pass -k flag to git mailinfo (see git-mailinfo(1)).
37
38       --keep-non-patch
39           Pass -b flag to git mailinfo (see git-mailinfo(1)).
40
41       --[no-]keep-cr
42           With --keep-cr, call git mailsplit (see git-mailsplit(1)) with the
43           same option, to prevent it from stripping CR at the end of lines.
44           am.keepcr configuration variable can be used to specify the default
45           behaviour.  --no-keep-cr is useful to override am.keepcr.
46
47       -c, --scissors
48           Remove everything in body before a scissors line (see git-
49           mailinfo(1)). Can be activated by default using the
50           mailinfo.scissors configuration variable.
51
52       --no-scissors
53           Ignore scissors lines (see git-mailinfo(1)).
54
55       --quoted-cr=<action>
56           This flag will be passed down to git mailinfo (see git-
57           mailinfo(1)).
58
59       --empty=(stop|drop|keep)
60           By default, or when the option is set to stop, the command errors
61           out on an input e-mail message lacking a patch and stops into the
62           middle of the current am session. When this option is set to drop,
63           skip such an e-mail message instead. When this option is set to
64           keep, create an empty commit, recording the contents of the e-mail
65           message as its log.
66
67       -m, --message-id
68           Pass the -m flag to git mailinfo (see git-mailinfo(1)), so that the
69           Message-ID header is added to the commit message. The am.messageid
70           configuration variable can be used to specify the default
71           behaviour.
72
73       --no-message-id
74           Do not add the Message-ID header to the commit message.
75           no-message-id is useful to override am.messageid.
76
77       -q, --quiet
78           Be quiet. Only print error messages.
79
80       -u, --utf8
81           Pass -u flag to git mailinfo (see git-mailinfo(1)). The proposed
82           commit log message taken from the e-mail is re-coded into UTF-8
83           encoding (configuration variable i18n.commitEncoding can be used to
84           specify project’s preferred encoding if it is not UTF-8).
85
86           This was optional in prior versions of git, but now it is the
87           default. You can use --no-utf8 to override this.
88
89       --no-utf8
90           Pass -n flag to git mailinfo (see git-mailinfo(1)).
91
92       -3, --3way, --no-3way
93           When the patch does not apply cleanly, fall back on 3-way merge if
94           the patch records the identity of blobs it is supposed to apply to
95           and we have those blobs available locally.  --no-3way can be used
96           to override am.threeWay configuration variable. For more
97           information, see am.threeWay in git-config(1).
98
99       --rerere-autoupdate, --no-rerere-autoupdate
100           After the rerere mechanism reuses a recorded resolution on the
101           current conflict to update the files in the working tree, allow it
102           to also update the index with the result of resolution.
103           --no-rerere-autoupdate is a good way to double-check what rerere
104           did and catch potential mismerges, before committing the result to
105           the index with a separate git add.
106
107       --ignore-space-change, --ignore-whitespace, --whitespace=<option>,
108       -C<n>, -p<n>, --directory=<dir>, --exclude=<path>, --include=<path>,
109       --reject
110           These flags are passed to the git apply (see git-apply(1)) program
111           that applies the patch.
112
113       --patch-format
114           By default the command will try to detect the patch format
115           automatically. This option allows the user to bypass the automatic
116           detection and specify the patch format that the patch(es) should be
117           interpreted as. Valid formats are mbox, mboxrd, stgit, stgit-series
118           and hg.
119
120       -i, --interactive
121           Run interactively.
122
123       --committer-date-is-author-date
124           By default the command records the date from the e-mail message as
125           the commit author date, and uses the time of commit creation as the
126           committer date. This allows the user to lie about the committer
127           date by using the same value as the author date.
128
129       --ignore-date
130           By default the command records the date from the e-mail message as
131           the commit author date, and uses the time of commit creation as the
132           committer date. This allows the user to lie about the author date
133           by using the same value as the committer date.
134
135       --skip
136           Skip the current patch. This is only meaningful when restarting an
137           aborted patch.
138
139       -S[<keyid>], --gpg-sign[=<keyid>], --no-gpg-sign
140           GPG-sign commits. The keyid argument is optional and defaults to
141           the committer identity; if specified, it must be stuck to the
142           option without a space.  --no-gpg-sign is useful to countermand
143           both commit.gpgSign configuration variable, and earlier --gpg-sign.
144
145       --continue, -r, --resolved
146           After a patch failure (e.g. attempting to apply conflicting patch),
147           the user has applied it by hand and the index file stores the
148           result of the application. Make a commit using the authorship and
149           commit log extracted from the e-mail message and the current index
150           file, and continue.
151
152       --resolvemsg=<msg>
153           When a patch failure occurs, <msg> will be printed to the screen
154           before exiting. This overrides the standard message informing you
155           to use --continue or --skip to handle the failure. This is solely
156           for internal use between git rebase and git am.
157
158       --abort
159           Restore the original branch and abort the patching operation.
160           Revert contents of files involved in the am operation to their
161           pre-am state.
162
163       --quit
164           Abort the patching operation but keep HEAD and the index untouched.
165
166       --show-current-patch[=(diff|raw)]
167           Show the message at which git am has stopped due to conflicts. If
168           raw is specified, show the raw contents of the e-mail message; if
169           diff, show the diff portion only. Defaults to raw.
170
171       --allow-empty
172           After a patch failure on an input e-mail message lacking a patch,
173           create an empty commit with the contents of the e-mail message as
174           its log message.
175

DISCUSSION

177       The commit author name is taken from the "From: " line of the message,
178       and commit author date is taken from the "Date: " line of the message.
179       The "Subject: " line is used as the title of the commit, after
180       stripping common prefix "[PATCH <anything>]". The "Subject: " line is
181       supposed to concisely describe what the commit is about in one line of
182       text.
183
184       "From: ", "Date: ", and "Subject: " lines starting the body override
185       the respective commit author name and title values taken from the
186       headers.
187
188       The commit message is formed by the title taken from the "Subject: ", a
189       blank line and the body of the message up to where the patch begins.
190       Excess whitespace at the end of each line is automatically stripped.
191
192       The patch is expected to be inline, directly following the message. Any
193       line that is of the form:
194
195       •   three-dashes and end-of-line, or
196
197       •   a line that begins with "diff -", or
198
199       •   a line that begins with "Index: "
200
201       is taken as the beginning of a patch, and the commit log message is
202       terminated before the first occurrence of such a line.
203
204       When initially invoking git am, you give it the names of the mailboxes
205       to process. Upon seeing the first patch that does not apply, it aborts
206       in the middle. You can recover from this in one of two ways:
207
208        1. skip the current patch by re-running the command with the --skip
209           option.
210
211        2. hand resolve the conflict in the working directory, and update the
212           index file to bring it into a state that the patch should have
213           produced. Then run the command with the --continue option.
214
215       The command refuses to process new mailboxes until the current
216       operation is finished, so if you decide to start over from scratch, run
217       git am --abort before running the command with mailbox names.
218
219       Before any patches are applied, ORIG_HEAD is set to the tip of the
220       current branch. This is useful if you have problems with multiple
221       commits, like running git am on the wrong branch or an error in the
222       commits that is more easily fixed by changing the mailbox (e.g. errors
223       in the "From:" lines).
224

HOOKS

226       This command can run applypatch-msg, pre-applypatch, and
227       post-applypatch hooks. See githooks(5) for more information.
228

CONFIGURATION

230       Everything below this line in this section is selectively included from
231       the git-config(1) documentation. The content is the same as what’s
232       found there:
233
234       am.keepcr
235           If true, git-am will call git-mailsplit for patches in mbox format
236           with parameter --keep-cr. In this case git-mailsplit will not
237           remove \r from lines ending with \r\n. Can be overridden by giving
238           --no-keep-cr from the command line. See git-am(1), git-
239           mailsplit(1).
240
241       am.threeWay
242           By default, git am will fail if the patch does not apply cleanly.
243           When set to true, this setting tells git am to fall back on 3-way
244           merge if the patch records the identity of blobs it is supposed to
245           apply to and we have those blobs available locally (equivalent to
246           giving the --3way option from the command line). Defaults to false.
247           See git-am(1).
248

SEE ALSO

250       git-apply(1).
251

GIT

253       Part of the git(1) suite
254
255
256
257Git 2.39.1                        2023-01-13                         GIT-AM(1)
Impressum