6 git-am - Apply a series of patches from a mailbox
12 'git am' [--signoff] [--keep] [--utf8 | --no-utf8]
13 [--3way] [--interactive] [--committer-date-is-author-date]
15 [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
17 [<mbox> | <Maildir>...]
18 'git am' (--skip | --resolved | --abort)
22 Splits mail messages in a mailbox into commit log message,
23 authorship information and patches, and applies them to the
29 The list of mailbox files to read patches from. If you do not
30 supply this argument, the command reads from the standard input.
31 If you supply directories, they will be treated as Maildirs.
35 Add a `Signed-off-by:` line to the commit message, using
36 the committer identity of yourself.
40 Pass `-k` flag to 'git-mailinfo' (see linkgit:git-mailinfo[1]).
44 Pass `-u` flag to 'git-mailinfo' (see linkgit:git-mailinfo[1]).
45 The proposed commit log message taken from the e-mail
46 is re-coded into UTF-8 encoding (configuration variable
47 `i18n.commitencoding` can be used to specify project's
48 preferred encoding if it is not UTF-8).
50 This was optional in prior versions of git, but now it is the
51 default. You can use `--no-utf8` to override this.
54 Pass `-n` flag to 'git-mailinfo' (see
55 linkgit:git-mailinfo[1]).
59 When the patch does not apply cleanly, fall back on
60 3-way merge if the patch records the identity of blobs
61 it is supposed to apply to and we have those blobs
64 --whitespace=<option>::
69 These flags are passed to the 'git-apply' (see linkgit:git-apply[1])
77 --committer-date-is-author-date::
78 By default the command records the date from the e-mail
79 message as the commit author date, and uses the time of
80 commit creation as the committer date. This allows the
81 user to lie about the committer date by using the same
82 value as the author date.
85 By default the command records the date from the e-mail
86 message as the commit author date, and uses the time of
87 commit creation as the committer date. This allows the
88 user to lie about the author date by using the same
89 value as the committer date.
92 Skip the current patch. This is only meaningful when
93 restarting an aborted patch.
97 After a patch failure (e.g. attempting to apply
98 conflicting patch), the user has applied it by hand and
99 the index file stores the result of the application.
100 Make a commit using the authorship and commit log
101 extracted from the e-mail message and the current index
105 When a patch failure occurs, <msg> will be printed
106 to the screen before exiting. This overrides the
107 standard message informing you to use `--resolved`
108 or `--skip` to handle the failure. This is solely
109 for internal use between 'git-rebase' and 'git-am'.
112 Restore the original branch and abort the patching operation.
117 The commit author name is taken from the "From: " line of the
118 message, and commit author date is taken from the "Date: " line
119 of the message. The "Subject: " line is used as the title of
120 the commit, after stripping common prefix "[PATCH <anything>]".
121 The "Subject: " line is supposed to concisely describe what the
122 commit is about in one line of text.
124 "From: " and "Subject: " lines starting the body (the rest of the
125 message after the blank line terminating the RFC2822 headers)
126 override the respective commit author name and title values taken
129 The commit message is formed by the title taken from the
130 "Subject: ", a blank line and the body of the message up to
131 where the patch begins. Excess whitespace at the end of each
132 line is automatically stripped.
134 The patch is expected to be inline, directly following the
135 message. Any line that is of the form:
137 * three-dashes and end-of-line, or
138 * a line that begins with "diff -", or
139 * a line that begins with "Index: "
141 is taken as the beginning of a patch, and the commit log message
142 is terminated before the first occurrence of such a line.
144 When initially invoking `git am`, you give it the names of the mailboxes
145 to process. Upon seeing the first patch that does not apply, it
146 aborts in the middle. You can recover from this in one of two ways:
148 . skip the current patch by re-running the command with the '--skip'
151 . hand resolve the conflict in the working directory, and update
152 the index file to bring it into a state that the patch should
153 have produced. Then run the command with the '--resolved' option.
155 The command refuses to process new mailboxes while the `.git/rebase-apply`
156 directory exists, so if you decide to start over from scratch,
157 run `rm -f -r .git/rebase-apply` before running the command with mailbox
160 Before any patches are applied, ORIG_HEAD is set to the tip of the
161 current branch. This is useful if you have problems with multiple
162 commits, like running 'git am' on the wrong branch or an error in the
163 commits that is more easily fixed by changing the mailbox (e.g.
164 errors in the "From:" lines).
169 linkgit:git-apply[1].
174 Written by Junio C Hamano <gitster@pobox.com>
178 Documentation by Petr Baudis, Junio C Hamano and the git-list <git@vger.kernel.org>.
182 Part of the linkgit:git[1] suite