1git-am(1) 2========= 3 4NAME 5---- 6git-am - Apply a series of patches from a mailbox 7 8 9SYNOPSIS 10-------- 11[verse] 12'git am' [--signoff] [--keep] [--utf8 | --no-utf8] 13 [--3way] [--interactive] [--committer-date-is-author-date] 14 [--ignore-date] [--ignore-space-change | --ignore-whitespace] 15 [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>] 16 [--reject] [-q | --quiet] [--scissors] 17 [<mbox> | <Maildir>...] 18'git am' (--skip | --resolved | --abort) 19 20DESCRIPTION 21----------- 22Splits mail messages in a mailbox into commit log message, 23authorship information and patches, and applies them to the 24current branch. 25 26OPTIONS 27------- 28<mbox>|<Maildir>...:: 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. 32 33-s:: 34--signoff:: 35 Add a `Signed-off-by:` line to the commit message, using 36 the committer identity of yourself. 37 38-k:: 39--keep:: 40 Pass `-k` flag to 'git-mailinfo' (see linkgit:git-mailinfo[1]). 41 42-c:: 43--scissors:: 44 Remove everything in body before a scissors line (see 45 linkgit:git-mailinfo[1]). 46 47-q:: 48--quiet:: 49 Be quiet. Only print error messages. 50 51-u:: 52--utf8:: 53 Pass `-u` flag to 'git-mailinfo' (see linkgit:git-mailinfo[1]). 54 The proposed commit log message taken from the e-mail 55 is re-coded into UTF-8 encoding (configuration variable 56 `i18n.commitencoding` can be used to specify project's 57 preferred encoding if it is not UTF-8). 58+ 59This was optional in prior versions of git, but now it is the 60default. You can use `--no-utf8` to override this. 61 62--no-utf8:: 63 Pass `-n` flag to 'git-mailinfo' (see 64 linkgit:git-mailinfo[1]). 65 66-3:: 67--3way:: 68 When the patch does not apply cleanly, fall back on 69 3-way merge if the patch records the identity of blobs 70 it is supposed to apply to and we have those blobs 71 available locally. 72 73--ignore-date:: 74--ignore-space-change:: 75--ignore-whitespace:: 76--whitespace=<option>:: 77-C<n>:: 78-p<n>:: 79--directory=<dir>:: 80--reject:: 81 These flags are passed to the 'git-apply' (see linkgit:git-apply[1]) 82 program that applies 83 the patch. 84 85-i:: 86--interactive:: 87 Run interactively. 88 89--committer-date-is-author-date:: 90 By default the command records the date from the e-mail 91 message as the commit author date, and uses the time of 92 commit creation as the committer date. This allows the 93 user to lie about the committer date by using the same 94 value as the author date. 95 96--ignore-date:: 97 By default the command records the date from the e-mail 98 message as the commit author date, and uses the time of 99 commit creation as the committer date. This allows the 100 user to lie about the author date by using the same 101 value as the committer date. 102 103--skip:: 104 Skip the current patch. This is only meaningful when 105 restarting an aborted patch. 106 107-r:: 108--resolved:: 109 After a patch failure (e.g. attempting to apply 110 conflicting patch), the user has applied it by hand and 111 the index file stores the result of the application. 112 Make a commit using the authorship and commit log 113 extracted from the e-mail message and the current index 114 file, and continue. 115 116--resolvemsg=<msg>:: 117 When a patch failure occurs, <msg> will be printed 118 to the screen before exiting. This overrides the 119 standard message informing you to use `--resolved` 120 or `--skip` to handle the failure. This is solely 121 for internal use between 'git-rebase' and 'git-am'. 122 123--abort:: 124 Restore the original branch and abort the patching operation. 125 126DISCUSSION 127---------- 128 129The commit author name is taken from the "From: " line of the 130message, and commit author date is taken from the "Date: " line 131of the message. The "Subject: " line is used as the title of 132the commit, after stripping common prefix "[PATCH <anything>]". 133The "Subject: " line is supposed to concisely describe what the 134commit is about in one line of text. 135 136"From: " and "Subject: " lines starting the body override the respective 137commit author name and title values taken from the headers. 138 139The commit message is formed by the title taken from the 140"Subject: ", a blank line and the body of the message up to 141where the patch begins. Excess whitespace at the end of each 142line is automatically stripped. 143 144The patch is expected to be inline, directly following the 145message. Any line that is of the form: 146 147* three-dashes and end-of-line, or 148* a line that begins with "diff -", or 149* a line that begins with "Index: " 150 151is taken as the beginning of a patch, and the commit log message 152is terminated before the first occurrence of such a line. 153 154When initially invoking `git am`, you give it the names of the mailboxes 155to process. Upon seeing the first patch that does not apply, it 156aborts in the middle. You can recover from this in one of two ways: 157 158. skip the current patch by re-running the command with the '--skip' 159 option. 160 161. hand resolve the conflict in the working directory, and update 162 the index file to bring it into a state that the patch should 163 have produced. Then run the command with the '--resolved' option. 164 165The command refuses to process new mailboxes while the `.git/rebase-apply` 166directory exists, so if you decide to start over from scratch, 167run `rm -f -r .git/rebase-apply` before running the command with mailbox 168names. 169 170Before any patches are applied, ORIG_HEAD is set to the tip of the 171current branch. This is useful if you have problems with multiple 172commits, like running 'git am' on the wrong branch or an error in the 173commits that is more easily fixed by changing the mailbox (e.g. 174errors in the "From:" lines). 175 176 177SEE ALSO 178-------- 179linkgit:git-apply[1]. 180 181 182Author 183------ 184Written by Junio C Hamano <gitster@pobox.com> 185 186Documentation 187-------------- 188Documentation by Petr Baudis, Junio C Hamano and the git-list <git@vger.kernel.org>. 189 190GIT 191--- 192Part of the linkgit:git[1] suite