Sending patches

In the previous example, you saw how to create and apply patches. You can, of course, attach these patch files directly to an e-mail, but Git provides a way to send the patches directly as e-mails with the git send-email command. The command requires some setting up, but how you do that is heavily dependent on your general mail and SMTP configuration. A general guide can be found in the Git help pages or visit

Getting ready

We'll set up the same repository as in the previous example:

$ git clone
Cloning into 'offline-sharing'...
remote: Counting objects: 32, done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 32 (delta 7), reused ...

Get Git: Mastering Version Control now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.