using git send-email for sending kernel patches
Sending patches to a Linux kernel mailing list can be done easily using git-send-email. This post will help setup your environment and show you how to format the git send-email command. In addition there are some more advanced features that help when you need to send from multiple accounts.
First, install git and git-email. Then, setup
~/.gitconfig for your user
and proper sendemail section. This shows a sendemail setup for a typical single
[user] name = Your Name email = [email protected] [sendemail] from = Your Name <[email protected]> smtpserver = smtp.gmail.com smtpuser = [email protected] smtpencryption = tls smtppass = PASSWORD chainreplyto = true smtpserverport = 587
However, it may be more useful to be able to easily send from multiple accounts.
This can be accomplished using the
--identify flag in git.
[user] name = Your Name email =[email protected] [user "work"] email = [email protected] [user "gmail"] email = [email protected] [sendemail "work"] from = Your Name <[email protected]> smtpserver = smtp.work.com smtpuser = me smtppass = PASSWORD smtpencryption = tls smtpserverport = 587 chainreplyto = false [sendemail "gmail"] from = Your Name <[email protected]> smtpserver = smtp.gmail.com smtpuser = [email protected] smtppass = PASSWORD smtpencryption = tls smtpserverport = 587 chainreplyto = false
This way when you can select your identity to fill in these values. In addition if you specify no identity you can have default fields if necessary. If you added a [sendemail] field this would be called by default. Man git-config can show you more options.
Formatting the Patch
Once we have the patch committed to the HEAD on our branch we format the patch
git format-patch -1.
This should produce a patch like
Then check for formatting errors using the checkpatch script provided in the
You should read the kernel documentation to get a better idea of what is expected.
Sending A Single Patch
Now we are ready to send a patch. The
./scripts/get_maintainer.pl in the kernel
repository provides a way to specify whom needs to be CC’ed based on the
maintainers file, the history of the file, and which lines of code are changed.
git send-email --to <ml_list> --cc-cmd="scripts/get_maintainer.pl -i" \ <0001-patch.patch>
The -i means the script is interactive and you can edit the list before sending. Once you have completed the commands, the patch should be sent!
If you have your patches in a public git repository, it is sometimes easier to send pull-requests for patches instead of sending.
git request-pull <hash right before your changes> \ git://<public git repo> > request-pull.txt
Then add a ‘Subject: ’ line in the request-pull.txt that explains the pull request. Adding –subject doesn’t seem to work for me. In addition add any other text.
git send-email --identity=gmail --to=<mailing list> \ ./request-pull.txt
With this you should have a pull request sent!