send-email (git)
overview
the send-email command is an alternative workflow to pull requests and merge. instead of using a web-gui, it uses a e-mail based approach. to get started, download git. on some distributions of linux, you might need to install some additional packages to get send-email working correctly. please refer to this guide.
setup
next, setup git to use your email. run git config --global --edit. this will open the git configuration file in your default text editor. add the following lines:
[sendemail]
smtpserver = mail.example.org
smtpuser = you@example.org
smtpencryption = ssl
smtpserverport = 587
smtpencryption = tls
note that at this point you should also have configured git to use your email and your name. if not, run the following commands:
git config --global user.email "you@example.org"
git config --global user.name "Your Name"
first patch
to create a patch, first you need to create a commit:
echo "I'm about to try git send-email" >your-name
git add your-name
git commit -m "Demonstrate that I can use git send-email"
next you can send the head (the latest commit):
git send-email --to="<mailing-list>" HEAD^
making changes to a patch
sometimes the patch will not be accepted due to some issues in the code. the maintainer usually tells whats wrong and what you need to change. after making your changes, you can amend your commit. this will "update" your latest commit so you wont have to create a new patch to fix your issues:
git commit -a --amend
to now send the patch, use the version tag -v2. with this we tell that this is a new version of a given patch. you might have to create multiple versions to get your patch merged into the upstream project. its useful to explain the changes made. you can explain those inside the email. to change the email use the --annotate flag. this will open the email in your text editor:
git send-email --annotate -v2 HEAD^
explain the changes under the ---:
Subject: [PATCH v2] Demonstrate that I can use git send-email
---
This fixes the issues raised from the first patch.
your-name | 1 +
1 file changed, 1 insertion(+)
tips and tricks
send the last 3 commits:
git send-email HEAD~3
send all commits since a particular one:
git send-email 209210d
"signing off" commits:
git config format.signOff yes