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 --rerere-autoupdate, --no-rerere-autoupdate
87 Allow the rerere mechanism to update the index with the result of
88 auto-conflict resolution if possible.
89
90 --ignore-space-change, --ignore-whitespace, --whitespace=<option>,
91 -C<n>, -p<n>, --directory=<dir>, --exclude=<path>, --include=<path>,
92 --reject
93 These flags are passed to the git apply (see git-apply(1)) program
94 that applies the patch.
95
96 --patch-format
97 By default the command will try to detect the patch format
98 automatically. This option allows the user to bypass the automatic
99 detection and specify the patch format that the patch(es) should be
100 interpreted as. Valid formats are mbox, mboxrd, stgit, stgit-series
101 and hg.
102
103 -i, --interactive
104 Run interactively.
105
106 --committer-date-is-author-date
107 By default the command records the date from the e-mail message as
108 the commit author date, and uses the time of commit creation as the
109 committer date. This allows the user to lie about the committer
110 date by using the same value as the author date.
111
112 --ignore-date
113 By default the command records the date from the e-mail message as
114 the commit author date, and uses the time of commit creation as the
115 committer date. This allows the user to lie about the author date
116 by using the same value as the committer date.
117
118 --skip
119 Skip the current patch. This is only meaningful when restarting an
120 aborted patch.
121
122 -S[<keyid>], --gpg-sign[=<keyid>]
123 GPG-sign commits. The keyid argument is optional and defaults to
124 the committer identity; if specified, it must be stuck to the
125 option without a space.
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
147 Show the patch being applied when "git am" is stopped because of
148 conflicts.
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: " and "Subject: " lines starting the body override the
159 respective commit author name and title values taken from the headers.
160
161 The commit message is formed by the title taken from the "Subject: ", a
162 blank line and the body of the message up to where the patch begins.
163 Excess whitespace at the end of each line is automatically stripped.
164
165 The patch is expected to be inline, directly following the message. Any
166 line that is of the form:
167
168 · three-dashes and end-of-line, or
169
170 · a line that begins with "diff -", or
171
172 · a line that begins with "Index: "
173
174 is taken as the beginning of a patch, and the commit log message is
175 terminated before the first occurrence of such a line.
176
177 When initially invoking git am, you give it the names of the mailboxes
178 to process. Upon seeing the first patch that does not apply, it aborts
179 in the middle. You can recover from this in one of two ways:
180
181 1. skip the current patch by re-running the command with the --skip
182 option.
183
184 2. hand resolve the conflict in the working directory, and update the
185 index file to bring it into a state that the patch should have
186 produced. Then run the command with the --continue option.
187
188 The command refuses to process new mailboxes until the current
189 operation is finished, so if you decide to start over from scratch, run
190 git am --abort before running the command with mailbox names.
191
192 Before any patches are applied, ORIG_HEAD is set to the tip of the
193 current branch. This is useful if you have problems with multiple
194 commits, like running git am on the wrong branch or an error in the
195 commits that is more easily fixed by changing the mailbox (e.g. errors
196 in the "From:" lines).
197
199 This command can run applypatch-msg, pre-applypatch, and
200 post-applypatch hooks. See githooks(5) for more information.
201
203 git-apply(1).
204
206 Part of the git(1) suite
207
208
209
210Git 2.24.1 12/10/2019 GIT-AM(1)