Skip to content
Latchkey

git am: Usage, Options & Common CI Errors

git am replays a mailbox of patches, creating a commit for each - the counterpart to format-patch.

am applies emailed or generated patch series back into history as real commits, preserving authorship.

What it does

git am reads patches in mailbox format (from format-patch or an mbox) and applies each as a commit on the current branch, keeping the original author and message.

Common usage

Terminal
git am series.mbox
git am --3way series.mbox          # 3-way merge on conflict
git am < patch.eml
# after fixing a conflict:
git add <file> && git am --continue
git am --abort

Options

FlagWhat it does
--3way / -3Fall back to 3-way merge
--continueResume after resolving conflicts
--skipSkip the current patch
--abortRestore the pre-am state
-s / --signoffAdd a Signed-off-by line

Common errors in CI

error: "Patch failed at 0001 …" with "hint: Use git am --show-current-patch to see the failed patch" - the patch did not apply cleanly. Try --3way, resolve and --continue, --skip to drop it, or --abort to bail out.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →