table of contents
- bullseye 1:2.30.2-1
- bullseye-backports 1:2.39.2-1~bpo11+1
- testing 1:2.39.2-1.1
- unstable 1:2.40.1-1
- experimental 1:2.40.1+next.20230427-1
git-am - Apply a series of patches from a mailbox
git am [--signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8]
[--[no-]3way] [--interactive] [--committer-date-is-author-date]
[--ignore-date] [--ignore-space-change | --ignore-whitespace]
[--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
[--exclude=<path>] [--include=<path>] [--reject] [-q | --quiet]
[--[no-]scissors] [-S[<keyid>]] [--patch-format=<format>]
[(<mbox> | <Maildir>)...] git am (--continue | --skip | --abort | --quit | --show-current-patch[=(diff|raw)] | --allow-empty)
Splits mail messages in a mailbox into commit log message, authorship information and patches, and applies them to the current branch.
This was optional in prior versions of git, but now it is the default. You can use --no-utf8 to override this.
-3, --3way, --no-3way
--ignore-space-change, --ignore-whitespace, --whitespace=<option>, -C<n>, -p<n>, --directory=<dir>, --exclude=<path>, --include=<path>, --reject
-S[<keyid>], --gpg-sign[=<keyid>], --no-gpg-sign
--continue, -r, --resolved
The commit author name is taken from the "From: " line of the message, and commit author date is taken from the "Date: " line of the message. The "Subject: " line is used as the title of the commit, after stripping common prefix "[PATCH <anything>]". The "Subject: " line is supposed to concisely describe what the commit is about in one line of text.
"From: ", "Date: ", and "Subject: " lines starting the body override the respective commit author name and title values taken from the headers.
The commit message is formed by the title taken from the "Subject: ", a blank line and the body of the message up to where the patch begins. Excess whitespace at the end of each line is automatically stripped.
The patch is expected to be inline, directly following the message. Any line that is of the form:
is taken as the beginning of a patch, and the commit log message is terminated before the first occurrence of such a line.
When initially invoking git am, you give it the names of the mailboxes to process. Upon seeing the first patch that does not apply, it aborts in the middle. You can recover from this in one of two ways:
The command refuses to process new mailboxes until the current operation is finished, so if you decide to start over from scratch, run git am --abort before running the command with mailbox names.
Before any patches are applied, ORIG_HEAD is set to the tip of the current branch. This is useful if you have problems with multiple commits, like running git am on the wrong branch or an error in the commits that is more easily fixed by changing the mailbox (e.g. errors in the "From:" lines).
This command can run applypatch-msg, pre-applypatch, and post-applypatch hooks. See githooks(5) for more information.
Everything below this line in this section is selectively included from the git-config(1) documentation. The content is the same as what’s found there:
Part of the git(1) suite