Documentation / git-am.txton commit git-svn: allow disabling expensive broken symlink checks (4c58a71)
   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]
  15         [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
  16         [--reject]
  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, reads from the standard input. If you supply
  31        directories, they'll be treated as Maildirs.
  32
  33-s::
  34--signoff::
  35        Add `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-u::
  43--utf8::
  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).
  49+
  50This was optional in prior versions of git, but now it is the
  51default.   You could use `--no-utf8` to override this.
  52
  53--no-utf8::
  54        Pass `-n` flag to 'git-mailinfo' (see
  55        linkgit:git-mailinfo[1]).
  56
  57-3::
  58--3way::
  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
  62        available locally.
  63
  64--whitespace=<option>::
  65-C<n>::
  66-p<n>::
  67--directory=<dir>::
  68--reject::
  69        These flags are passed to the 'git-apply' (see linkgit:git-apply[1])
  70        program that applies
  71        the patch.
  72
  73-i::
  74--interactive::
  75        Run interactively.
  76
  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        timestamp as the author date.
  83
  84--ignore-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 author timestamp by using the same
  89        timestamp as the committer date.
  90
  91--skip::
  92        Skip the current patch.  This is only meaningful when
  93        restarting an aborted patch.
  94
  95-r::
  96--resolved::
  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
 102        file, and continue.
 103
 104--resolvemsg=<msg>::
 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'.
 110
 111--abort::
 112        Restore the original branch and abort the patching operation.
 113
 114DISCUSSION
 115----------
 116
 117The commit author name is taken from the "From: " line of the
 118message, and commit author time is taken from the "Date: " line
 119of the message.  The "Subject: " line is used as the title of
 120the commit, after stripping common prefix "[PATCH <anything>]".
 121It is supposed to describe what the commit is about concisely as
 122a one line text.
 123
 124The body of the message (iow, after a blank line that terminates
 125RFC2822 headers) can begin with "Subject: " and "From: " lines
 126that are different from those of the mail header, to override
 127the values of these fields.
 128
 129The commit message is formed by the title taken from the
 130"Subject: ", a blank line and the body of the message up to
 131where the patch begins.  Excess whitespaces at the end of the
 132lines are automatically stripped.
 133
 134The patch is expected to be inline, directly following the
 135message.  Any line that is of form:
 136
 137* three-dashes and end-of-line, or
 138* a line that begins with "diff -", or
 139* a line that begins with "Index: "
 140
 141is taken as the beginning of a patch, and the commit log message
 142is terminated before the first occurrence of such a line.
 143
 144When initially invoking it, you give it names of the mailboxes
 145to crunch.  Upon seeing the first patch that does not apply, it
 146aborts in the middle,.  You can recover from this in one of two ways:
 147
 148. skip the current patch by re-running the command with '--skip'
 149  option.
 150
 151. hand resolve the conflict in the working directory, and update
 152  the index file to bring it in a state that the patch should
 153  have produced.  Then run the command with '--resolved' option.
 154
 155The command refuses to process new mailboxes while `.git/rebase-apply`
 156directory exists, so if you decide to start over from scratch,
 157run `rm -f -r .git/rebase-apply` before running the command with mailbox
 158names.
 159
 160Before any patches are applied, ORIG_HEAD is set to the tip of the
 161current branch.  This is useful if you have problems with multiple
 162commits, like running 'git am' on the wrong branch or an error in the
 163commits that is more easily fixed by changing the mailbox (e.g.
 164errors in the "From:" lines).
 165
 166
 167SEE ALSO
 168--------
 169linkgit:git-apply[1].
 170
 171
 172Author
 173------
 174Written by Junio C Hamano <gitster@pobox.com>
 175
 176Documentation
 177--------------
 178Documentation by Petr Baudis, Junio C Hamano and the git-list <git@vger.kernel.org>.
 179
 180GIT
 181---
 182Part of the linkgit:git[1] suite