Email-driven Git workflow

tags: engineering · tutorials

Basic Git configuration (in case you haven’t already done that):

$ git config --global
$ git config --global "Your Name"

Git email configuration:

$ git config --global sendemail.smtpserver your_mail_server
$ git config --global sendemail.smtpuser
$ git config --global sendemail.smtpserverport your_smtp_port
$ git config --global sendemail.smtpencryption your_encryption_type


Apply a patch (or simply make a commit) and send it to a mailing list:

$ git am < some_patch
$ git send-email HEAD^

Fix last commit and send it:

$ git commit -a --amend
$ git send-email --annotate -v2 HEAD^

Send 3 last commits (see Revision Selection for more info on the notation):

$ git send-email HEAD~3

Send the last commit to and make the subject look like “[reponame][PATCH] commitmsg”. This is useful for sending patches to mailing lists or programmers with multiple projects:

$ git send-email --subject-prefix="${PWD##*/}][PATCH" \ -1

git-send-email(1) manual page. Simple as that. None of that fork & pull request crap.

Further reading

  1. Mailing lists vs GitHub
  2. You’re using Git wrong
  3. The advantages of an email-driven Git workflow