Prepare Email Patches With git format-patch
Export commits as mbox files suitable for mailing lists.
Run git format-patch -1 HEAD -o patches/ to write the last commit as a .patch file.
01Command
Command
$ git format-patch -1 HEAD -o patches/02What it does
format-patch captures a commit as an email-compatible patch with the message, author and diff, which projects like the Linux kernel review through mailing lists. It shows how Git's workflow extends beyond web pull requests.
03Risk
!Warning: Patches embed author email addresses; confirm the identity and recipients before sending.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- git-format-patch documentationEvidence: Documents git format-patch, which prepares patches for email submission.
Last verified: 2026-10-13 · Category: Developer