1GIT-AM(1) Git Manual GIT-AM(1)
2
3
4
6 git-am - Apply a series of patches from a mailbox
7
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 [(<mbox> | <Maildir>)...]
17 git am (--continue | --skip | --abort | --quit | --show-current-patch[=(diff|raw)])
18
20 Splits mail messages in a mailbox into commit log message, authorship
21 information and patches, and applies them to the current branch.
22
24 (<mbox>|<Maildir>)...
25 The list of mailbox files to read patches from. If you do not
26 supply this argument, the command reads from the standard input. If
27 you supply directories, they will be treated as Maildirs.
28
29 -s, --signoff
30 Add a Signed-off-by trailer to the commit message, using the
31 committer identity of yourself. See the signoff option in git-
32 commit(1) for more information.
33
34 -k, --keep
35 Pass -k flag to git mailinfo (see git-mailinfo(1)).
36
37 --keep-non-patch
38 Pass -b flag to git mailinfo (see git-mailinfo(1)).
39
40 --[no-]keep-cr
41 With --keep-cr, call git mailsplit (see git-mailsplit(1)) with the
42 same option, to prevent it from stripping CR at the end of lines.
43 am.keepcr configuration variable can be used to specify the default
44 behaviour. --no-keep-cr is useful to override am.keepcr.
45
46 -c, --scissors
47 Remove everything in body before a scissors line (see git-
48 mailinfo(1)). Can be activated by default using the
49 mailinfo.scissors configuration variable.
50
51 --no-scissors
52 Ignore scissors lines (see git-mailinfo(1)).
53
54 --quoted-cr=<action>
55 This flag will be passed down to git mailinfo (see git-
56 mailinfo(1)).
57
58 -m, --message-id
59 Pass the -m flag to git mailinfo (see git-mailinfo(1)), so that the
60 Message-ID header is added to the commit message. The am.messageid
61 configuration variable can be used to specify the default
62 behaviour.
63
64 --no-message-id
65 Do not add the Message-ID header to the commit message.
66 no-message-id is useful to override am.messageid.
67
68 -q, --quiet
69 Be quiet. Only print error messages.
70
71 -u, --utf8
72 Pass -u flag to git mailinfo (see git-mailinfo(1)). The proposed
73 commit log message taken from the e-mail is re-coded into UTF-8
74 encoding (configuration variable i18n.commitEncoding can be used to
75 specify project’s preferred encoding if it is not UTF-8).
76
77 This was optional in prior versions of git, but now it is the
78 default. You can use --no-utf8 to override this.
79
80 --no-utf8
81 Pass -n flag to git mailinfo (see git-mailinfo(1)).
82
83 -3, --3way, --no-3way
84 When the patch does not apply cleanly, fall back on 3-way merge if
85 the patch records the identity of blobs it is supposed to apply to
86 and we have those blobs available locally. --no-3way can be used
87 to override am.threeWay configuration variable. For more
88 information, see am.threeWay in git-config(1).
89
90 --rerere-autoupdate, --no-rerere-autoupdate
91 Allow the rerere mechanism to update the index with the result of
92 auto-conflict resolution if possible.
93
94 --ignore-space-change, --ignore-whitespace, --whitespace=<option>,
95 -C<n>, -p<n>, --directory=<dir>, --exclude=<path>, --include=<path>,
96 --reject
97 These flags are passed to the git apply (see git-apply(1)) program
98 that applies the patch.
99
100 --patch-format
101 By default the command will try to detect the patch format
102 automatically. This option allows the user to bypass the automatic
103 detection and specify the patch format that the patch(es) should be
104 interpreted as. Valid formats are mbox, mboxrd, stgit, stgit-series
105 and hg.
106
107 -i, --interactive
108 Run interactively.
109
110 --committer-date-is-author-date
111 By default the command records the date from the e-mail message as
112 the commit author date, and uses the time of commit creation as the
113 committer date. This allows the user to lie about the committer
114 date by using the same value as the author date.
115
116 --ignore-date
117 By default the command records the date from the e-mail message as
118 the commit author date, and uses the time of commit creation as the
119 committer date. This allows the user to lie about the author date
120 by using the same value as the committer date.
121
122 --skip
123 Skip the current patch. This is only meaningful when restarting an
124 aborted patch.
125
126 -S[<keyid>], --gpg-sign[=<keyid>], --no-gpg-sign
127 GPG-sign commits. The keyid argument is optional and defaults to
128 the committer identity; if specified, it must be stuck to the
129 option without a space. --no-gpg-sign is useful to countermand
130 both commit.gpgSign configuration variable, and earlier --gpg-sign.
131
132 --continue, -r, --resolved
133 After a patch failure (e.g. attempting to apply conflicting patch),
134 the user has applied it by hand and the index file stores the
135 result of the application. Make a commit using the authorship and
136 commit log extracted from the e-mail message and the current index
137 file, and continue.
138
139 --resolvemsg=<msg>
140 When a patch failure occurs, <msg> will be printed to the screen
141 before exiting. This overrides the standard message informing you
142 to use --continue or --skip to handle the failure. This is solely
143 for internal use between git rebase and git am.
144
145 --abort
146 Restore the original branch and abort the patching operation.
147 Revert contents of files involved in the am operation to their
148 pre-am state.
149
150 --quit
151 Abort the patching operation but keep HEAD and the index untouched.
152
153 --show-current-patch[=(diff|raw)]
154 Show the message at which git am has stopped due to conflicts. If
155 raw is specified, show the raw contents of the e-mail message; if
156 diff, show the diff portion only. Defaults to raw.
157
159 The commit author name is taken from the "From: " line of the message,
160 and commit author date is taken from the "Date: " line of the message.
161 The "Subject: " line is used as the title of the commit, after
162 stripping common prefix "[PATCH <anything>]". The "Subject: " line is
163 supposed to concisely describe what the commit is about in one line of
164 text.
165
166 "From: ", "Date: ", and "Subject: " lines starting the body override
167 the respective commit author name and title values taken from the
168 headers.
169
170 The commit message is formed by the title taken from the "Subject: ", a
171 blank line and the body of the message up to where the patch begins.
172 Excess whitespace at the end of each line is automatically stripped.
173
174 The patch is expected to be inline, directly following the message. Any
175 line that is of the form:
176
177 • three-dashes and end-of-line, or
178
179 • a line that begins with "diff -", or
180
181 • a line that begins with "Index: "
182
183 is taken as the beginning of a patch, and the commit log message is
184 terminated before the first occurrence of such a line.
185
186 When initially invoking git am, you give it the names of the mailboxes
187 to process. Upon seeing the first patch that does not apply, it aborts
188 in the middle. You can recover from this in one of two ways:
189
190 1. skip the current patch by re-running the command with the --skip
191 option.
192
193 2. hand resolve the conflict in the working directory, and update the
194 index file to bring it into a state that the patch should have
195 produced. Then run the command with the --continue option.
196
197 The command refuses to process new mailboxes until the current
198 operation is finished, so if you decide to start over from scratch, run
199 git am --abort before running the command with mailbox names.
200
201 Before any patches are applied, ORIG_HEAD is set to the tip of the
202 current branch. This is useful if you have problems with multiple
203 commits, like running git am on the wrong branch or an error in the
204 commits that is more easily fixed by changing the mailbox (e.g. errors
205 in the "From:" lines).
206
208 This command can run applypatch-msg, pre-applypatch, and
209 post-applypatch hooks. See githooks(5) for more information.
210
212 git-apply(1).
213
215 Part of the git(1) suite
216
217
218
219Git 2.33.1 2021-10-12 GIT-AM(1)