LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

git-am

Apply patches from email messages in mbox format

TLDR

Apply patches from mailbox
$ git am [patches.mbox]
copy
Apply patch files
$ git am [*.patch]
copy
Apply with 3-way merge
$ git am --3way [patch]
copy
Apply and add Signed-off-by line
$ git am --signoff [patch]
copy
Continue after resolving conflicts
$ git am --continue
copy
Skip current patch
$ git am --skip
copy
Show the patch where am stopped
$ git am --show-current-patch
copy
Abort patch application
$ git am --abort
copy

SYNOPSIS

git am [options] [mbox|maildir]

DESCRIPTION

git am (apply mailbox) applies patches from email messages. It reads patches in mbox format, commonly used for email-based patch submission workflows in open source projects.The command extracts patch content and commit message from email format, creating commits with the original author information preserved. It handles patch series and manages conflicts through --skip, --abort, and --continue operations.This workflow remains fundamental to the Linux kernel development process and other projects that rely on email-based code review and patch submission.

PARAMETERS

MBOX

Mailbox file with patches.
--3way, -3
Fall back to 3-way merge if the patch does not apply cleanly.
--signoff, -s
Add a Signed-off-by trailer to the commit message.
--keep, -k
Pass -k to git mailinfo; preserve the subject prefix.
--quiet, -q
Only print error messages.
--whitespace action
Handle whitespace errors: nowarn, warn, fix, error, error-all.
--reject
Leave rejected hunks in .rej files instead of failing.
--patch-format format
Specify the patch format: mbox, mboxrd, stgit, stgit-series, hg.
--skip
Skip the current patch.
--continue, --resolved, -r
Continue after manually resolving a conflict.
--abort
Abort and restore the original branch state.
--quit
Abort but leave HEAD and index unchanged.
--show-current-patch [=diff|=raw]
Show the patch where am stopped; default is raw.
--gpg-sign [keyid], -S [keyid]
GPG-sign the resulting commits.
-i, --interactive
Run interactively.
--help
Display help information.

CAVEATS

Patch format must be correct mbox/maildir format. Conflicts require manual resolution followed by `--continue`. Original author information and dates are preserved from the email headers.

HISTORY

git am was designed for the Linux kernel development workflow where patches are submitted and reviewed via email on mailing lists.

SEE ALSO

Copied to clipboard
Kai