In this article I will describe the process of sending and receiving patches through email (for Gmail) for git repositories. Before sending an email make patch using git format-patch. Here is an example of fetching a patch starting from commit A to commit B
git format-patch -o /my/output/dir/ <SHA1-for-A>..<SHA1-for-B>
It will generate a *.patch which you will send through email. The best way to email the patch is to use the git send-email command. For using it through Gmail you have to do this configurations for your git.
git config --global sendemail.smtpserver smtp.gmail.com git config --global sendemail.smtpserverport 587 git config --global sendemail.smtpencryption tls git config --global sendemail.smtpuser <your_email>
After configuring smtp for Gmail you can send your first patch through email. Just run git send-email command
git send-email *.patch
and git will ask you some questions and your Gmail account password.
If you received a patch from someone on your Gmail account you need to save the original received message from Gmail web interface and remove first blank line from it. After that you need to run git am command to apply it to your repository.
git am patch_saved_from_gmail