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