git-format-patch
Prepare patches for email submission
TLDR
Create patches for last N commits
SYNOPSIS
git format-patch [options] [since] | [revision-range]
DESCRIPTION
git format-patch generates patch files from commits in a format suitable for email-based code review and submission workflows. Each commit is formatted as a separate .patch file containing the diff, commit metadata, and message in mbox format.
This command is fundamental to email-based development workflows used by projects like the Linux kernel and Git itself. The generated patches can be sent using git send-email or standard email clients, and applied with git am while preserving full commit information including author and date.
Cover letters (--cover-letter) provide a way to introduce patch series with context. Version numbering with -v supports iterative review cycles. The signoff option adds Signed-off-by trailers for Developer Certificate of Origin compliance.
PARAMETERS
-n
Number of commits.-o, --output-directory dir
Output directory.--stdout
Output to stdout.--cover-letter
Generate cover letter.-s, --signoff
Add Signed-off-by.--subject-prefix prefix
Subject prefix.-v, --reroll-count n
Version number.
SEE ALSO
git-am(1), git-send-email(1)
