Skip to content
LatchkeyLatchkey home

git send-email: Usage, Options & Common CI Errors

git send-email sends format-patch output to reviewers as properly threaded emails.

For projects that review patches by email, send-email turns a series of .patch files into a clean, threaded submission over SMTP - the last step of the format-patch workflow.

What it does

git send-email takes patch files (from git format-patch) and emails them over a configured SMTP server, threading the series under the cover letter and honoring To/Cc trailers.

Common usage

Terminal
git send-email --to=maintainer@example.com *.patch
git format-patch -3 -o out/ && git send-email out/
git send-email --smtp-server=smtp.example.com --smtp-encryption=tls *.patch
git send-email --cc=list@example.com --to=maintainer@example.com 0001-*.patch

Options

FlagWhat it does
--to / --cc / --bccRecipients
--smtp-server <host>SMTP host (or a sendmail path)
--smtp-encryption=tls|sslTransport security
--annotateEdit each patch before sending
--dry-runShow what would be sent

Common errors in CI

git: ‘send-email’ is not a git command - the subcommand ships separately (the git-email package) and needs Perl plus Net::SMTP; install it on the runner. SMTP auth failures ("5.7.x authentication required") mean missing --smtp-user/--smtp-pass or an app password; use --dry-run to validate first.

Using this in CI

CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.

.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0   # history, tags, and git describe all need this

- run: |
    git rev-parse --is-shallow-repository   # expect false
    git rev-parse --abbrev-ref HEAD          # prints HEAD when detached

Frequently asked questions

git send-email: Usage, Options & Common CI Errors?
For projects that review patches by email, send-email turns a series of .patch files into a clean, threaded submission over SMTP - the last step of the format-patch workflow.
What it does?
git send-email takes patch files (from git format-patch) and emails them over a configured SMTP server, threading the series under the cover letter and honoring To/Cc trailers.
Common errors in CI?
git: ‘send-email’ is not a git command - the subcommand ships separately (the git-email package) and needs Perl plus Net::SMTP; install it on the runner. SMTP auth failures ("5.7.x authentication required") mean missing --smtp-user/--smtp-pass or an app password; use --dry-run to validate first.

Related guides

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card