建议使用git send-email发送补丁(更多关于发送补丁的信息请参考Community ). 本文介绍如何使用git send-email.git
你的git可能已经安装了,可是send-email命令不是git必需的组件。你能够使用“git send-email --help” 确认一下。若是显示send-email的man page,那么send-email已经安装再你的系统了。不然,你须要安装send-email命令。你的版本可能有一个send-email的安装包。在Debian下,这个安装包的名字是"git-email" 。
服务器
你应该告诉git你的名字和email地址。你可能已经作了这一步了,若是没有,执行下面的命令:app
git config --global user.name "My Name" git config --global user.email "myemail@example.com"
git send-email 发送emails经过你的SMTP 服务器, 因此你须要配置服务器参数。参考你的email提供商的文档找到正确的参数。下面是个人mail设置:this
git config --global sendemail.smtpencryption tls git config --global sendemail.smtpserver mail.messagingengine.com git config --global sendemail.smtpuser tanuk@fastmail.fm git config --global sendemail.smtpserverport 587 git config --global sendemail.smtppass hackme
Storing the password in the git configuration file is obviously a security risk. It's not mandatory to configure the password. If it's not configured, git send-email will ask it every time the command is used.code
For PulseAudio, the patches should be sent to our mailing list. In order to avoid having to remember it and retyping it all the time, you can configure the address to be used by default by git send-email. As you may contribute to many projects using git, it does not make sense to set this option globally so instead we'll only set it in our clone of the PulseAudio code.orm
git config sendemail.to pulseaudio-discuss@lists.freedesktop.org
默认状况下,git send-email会把做者添加到Cc:field. 当你发送你本身写的patches, 这意味着每一个patch的拷贝都会发送到你本身的邮箱. 若是你不喜欢这样, 你能够经过设置下面的选项来避免这种状况(see "git send-email --help" for the full list of possible values):server
git config --global sendemail.suppresscc self
See "git send-email --help" for the full reference. I'll go through only the basic usage here.three
git send-email will ask a few questions before the patches are sent (update: newer git versions ask fewer questions, sometimes no questions at all). Most of the questions have a sensible default value shown in square brackets. Just press enter to use the default value. Type the answer to the question if you don't want to use the default answer. The questions are:ip
在当前的分支发送最新的commit:rem
git send-email -1
发送其余的commit:
git send-email -1 <commit reference>
Sending the last 10 commits in the current branch:
git send-email -10 --cover-letter --annotate
The --cover-letter option creates an extra mail that will be sent before the actual patch mails. You can add write some introduction to the patch set in the cover letter. If you need to explain the patches, be sure to include the explanations also in the commit messages, because the cover letter text won't be recorded in the git history. If you don't think any introduction or explanation is necessary, it's fine to only have the shortlog that is included in the cover letter by default, and only set the "Subject" header to something sensible.
The --annotate option causes an editor to be started for each of the mails, allowing you to edit the mails. The option is always necessary, so that you can edit the cover letter's "Subject" header.
By default the patch mails will have "[PATCH]" in the subject (or "[PATCH n/m]", where n is the sequence number of the patch and m is the total number of patches in the patch set). When sending updated versions of patches, the version should be indicated: "[PATCH v2]" or "[PATCH v2 n/m]". To do this, use the --annotate option and edit the "Subject" header of the mails.
Sometimes it's convenient to annotate patches with some notes that are not meant to be included in the commit message. For example, one might want to write "I'm not sure if this should be committed yet, because..." in a patch, but the text doesn't make sense in the commit message. Such messages can be written below the three dashes "---" that are in every patch after the commit message. Use the --annotate option with git send-email to be able to edit the mails before they are sent.
原文http://www.freedesktop.org/wiki/Software/PulseAudio/HowToUseGitSendEmail/