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: line 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>]
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.
125
126 --continue, -r, --resolved
127 After a patch failure (e.g. attempting to apply conflicting patch),
128 the user has applied it by hand and the index file stores the
129 result of the application. Make a commit using the authorship and
130 commit log extracted from the e-mail message and the current index
131 file, and continue.
132
133 --resolvemsg=<msg>
134 When a patch failure occurs, <msg> will be printed to the screen
135 before exiting. This overrides the standard message informing you
136 to use --continue or --skip to handle the failure. This is solely
137 for internal use between git rebase and git am.
138
139 --abort
140 Restore the original branch and abort the patching operation.
141
142 --quit
143 Abort the patching operation but keep HEAD and the index untouched.
144
145 --show-current-patch[=(diff|raw)]
146 Show the message at which git am has stopped due to conflicts. If
147 raw is specified, show the raw contents of the e-mail message; if
148 diff, show the diff portion only. Defaults to raw.
149
151 The commit author name is taken from the "From: " line of the message,
152 and commit author date is taken from the "Date: " line of the message.
153 The "Subject: " line is used as the title of the commit, after
154 stripping common prefix "[PATCH <anything>]". The "Subject: " line is
155 supposed to concisely describe what the commit is about in one line of
156 text.
157
158 "From: ", "Date: ", and "Subject: " lines starting the body override
159 the respective commit author name and title values taken from the
160 headers.
161
162 The commit message is formed by the title taken from the "Subject: ", a
163 blank line and the body of the message up to where the patch begins.
164 Excess whitespace at the end of each line is automatically stripped.
165
166 The patch is expected to be inline, directly following the message. Any
167 line that is of the form:
168
169 · three-dashes and end-of-line, or
170
171 · a line that begins with "diff -", or
172
173 · a line that begins with "Index: "
174
175 is taken as the beginning of a patch, and the commit log message is
176 terminated before the first occurrence of such a line.
177
178 When initially invoking git am, you give it the names of the mailboxes
179 to process. Upon seeing the first patch that does not apply, it aborts
180 in the middle. You can recover from this in one of two ways:
181
182 1. skip the current patch by re-running the command with the --skip
183 option.
184
185 2. hand resolve the conflict in the working directory, and update the
186 index file to bring it into a state that the patch should have
187 produced. Then run the command with the --continue option.
188
189 The command refuses to process new mailboxes until the current
190 operation is finished, so if you decide to start over from scratch, run
191 git am --abort before running the command with mailbox names.
192
193 Before any patches are applied, ORIG_HEAD is set to the tip of the
194 current branch. This is useful if you have problems with multiple
195 commits, like running git am on the wrong branch or an error in the
196 commits that is more easily fixed by changing the mailbox (e.g. errors
197 in the "From:" lines).
198
200 This command can run applypatch-msg, pre-applypatch, and
201 post-applypatch hooks. See githooks(5) for more information.
202
204 git-apply(1).
205
207 Part of the git(1) suite
208
209
210
211Git 2.26.2 2020-04-20 GIT-AM(1)