Git Reference ยท Remotes and Collaboration
git send-email command
Reference for git send-email: configure SMTP, send format-patch series with a cover letter, use --dry-run, threading, --to/--cc and the sendemail.* settings.
git send-email sends patch files, usually the output of git format-patch, as emails through an SMTP server or a local sendmail program. It sets the threading headers so that a series arrives as one conversation, adds recipients, and can ask for confirmation before each send.
Projects that review on mailing lists (the Linux kernel, Git itself and many others) expect patches this way. The command is written in Perl and needs the Net::SMTP and Authen::SASL modules for authenticated servers. This site's runner has neither Perl nor a network, so the examples below prepare and inspect everything that send-email consumes without sending a message.
git send-email [options] <file|directory|revision-range>...
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Syntax
git send-email [--to=<addr>] [--cc=<addr>] [--bcc=<addr>] [--from=<addr>] [--smtp-server=<host>] [--smtp-encryption=tls|ssl] [--compose] [--annotate] [--dry-run] [--thread] [--confirm=<mode>] [--in-reply-to=<message-id>] [--8bit-encoding=<enc>] <patches>
| Option | Description |
|---|---|
--to, --cc, --bcc |
Recipients. May repeat. sendemail.to and friends provide defaults. |
--from=<address> |
Sender. Defaults to the committer identity, then sendemail.from. |
--smtp-server=<host or path> |
An SMTP host, or the full path of a sendmail-compatible program (default /usr/sbin/sendmail, then localhost). |
--smtp-server-port, --smtp-encryption, --smtp-user, --smtp-pass |
Connection details. Use a credential helper instead of storing the password in config. |
--compose |
Open the editor for a cover letter before sending. |
--annotate |
Open each patch in the editor for last-minute notes. |
--dry-run |
Do everything except actually send, and print what would happen. |
--confirm=(always|never|cc|compose|auto) |
When to ask before sending. |
--thread, --no-thread |
Add In-Reply-To and References so patches are replies to the first message (default on). |
--in-reply-to=<id> |
Attach the series to an existing conversation, for example when sending a new version. |
--suppress-cc=<category> |
Stop adding automatic Cc addresses (author, self, sob, cc, bodycc, misc-by, cccmd, all). |
--cc-cmd=<command> |
Command that prints extra Cc addresses for each patch. |
--validate, --no-validate |
Run the sendemail-validate hook and basic checks (default on). |
--identity=<name> |
Use the named sendemail.<name>.* group of settings. |
Usage notes
- Passing revisions. You can give a range like
base..HEADinstead of files;send-emailthen runsformat-patchfor you. - Test first.
--dry-runshows recipients and subjects. A common habit is to send the series to yourself before the list. - Threading and versions. Send version 2 as a new thread with
-v2patches, or reply into the old one with--in-reply-toif the project prefers that. - Gmail and other providers require app passwords or OAuth; plain account passwords are rejected. Use
smtpEncryptionwith port 587 (tls) or 465 (ssl). - Dependencies. Without
Net::SMTP::SSLorAuthen::SASLthe command fails at connect time with a message naming the module. Install the Perl packages from your system. - Before sending the
sendemail-validatehook can reject a series; see sendemail-validate. - Mail clients are not needed;
send-emailspeaks SMTP directly.