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