- Developers who already know basic commit and branch actions
- Readers who want to understand command boundaries and risk
Command Reference
git-send-email Tutorial
Send patch series produced by `format-patch` through email while preserving commit boundaries and thread context.
- A basic mental model of worktree, index, and commits
- Comfort reading `git status` and a small commit graph
- Using local cleanup commands on already shared history
- Continuing to rewrite before confirming a recovery path
Citations & Further Reading
- Git send email [Official]
- Distributed Git Contributing to a Project [Book]
What you will learn
- Understand the core purpose of git-send-email Tutorial
- Master the basic usage and common options of git-send-email Tutorial
- Send patch series produced by
format-patchthrough email while preserving commit boundaries and thread context. - Understand key concepts: Typical scenarios
- Know when to use this feature and when to avoid it
Start with a problem
You're working in a Git repository and need to perform a specific task — but you're not sure which command or option is the right fit, or what this command can and cannot do.
The short version
git send-email sends patch series via email, preserving commit granularity and discussion threading.
Typical scenarios
- mailing-list based contribution workflows
- maintainer projects requiring patch-by-email
- environments without direct hosted-platform access
Common companion flow
git format-patch -3 origin/main
git send-email *.patch
Generate patches first, then send.
Pre-send checklist
- SMTP/auth configuration works
- To/Cc recipients are correct
- thread conventions (subject prefix, reply chain) match project rules
- patch ordering and cover letter are complete
Safer send pattern
Dry-run or self-send before real list submission:
git send-email --dry-run *.patch
Frequent failure modes
- encoding/line-wrap issues corrupt patch application
- incorrect subject prefix violates list rules
- missing one patch in a series breaks review/application continuity
Once patches are mailed to public lists, correction cost rises quickly. Validate formatting and threading first.
Good follow-up reads
git-format-patchgit-request-pullopen source fork pr contributiongit send-emailtransmits patch files as emails to a mailing list or reviewer. It handles threading, encoding, and SMTP configuration — making it the delivery step aftergit format-patchhas prepared the patches.
Typical use cases
- Send a series of generated patch files to a project's mailing list:
git send-email *.patch. - Use
--toand--ccto direct patches to maintainers and interested reviewers. - Configure SMTP settings in
.gitconfigso that sending patches becomes a repeatable, one-command step.
Diagram view
Patch files (.patch)SMTP configurationRecipient addresses
Emails sent to recipientsThreaded patch series
Always do a dry run or test with a small scope first to verify recipients, threading, and encoding before the real send.
Special cases and boundaries
- Do a dry run or small-scope test first so recipients, threading, and encoding are all correct before the real send.
- SMTP credentials and server settings must be configured in
.gitconfigor via command-line flags before sending. send-emailpreserves the threading structure fromformat-patch, so patches arrive as a coherent email thread.- Some projects have specific patch submission guidelines (subject prefixes, sign-off requirements) — check the project's contribution guide before sending.
Try it yourself
- Practice the git-send-email command in a test repository and observe state changes before and after
- Experiment with different options and compare the output differences
- Simulate a real scenario where you would need to use this, and walk through the full process
Further reading
Keep going on the same topic: