怎样在git send-email发送的patch前添加自己的注释

先用git把你的patch生成一个提交,提交中添加你的修改的描述。然后,git-format-patch生成这个patch. 再用git-send-email发送这个patch.流程:1. 修改代码,测试。2. git commit. 生成一个提交,加入patch描述。3. git format-patch -1. 生成patch, -1表示从HEAD开始生成一个patch, 也就是你刚commit的patch.4. git send-email \u0026lt;patch\u0026gt;
■网友
git commit message的第一行是邮件标题,第二行后是邮件正文。另外,早期版本在生成邮件的时候有个bug,我不清楚现在改了没有(我曾经提交过patch被要求进一步修改,然后我没时间就放弃了),因此建议在第一行和第二行之间空一行(git用空行来区分paragraph),可以避开潜在的bug。
■网友
简单来说,patch文件的three-dash分界上方是commit msg,git am的时候进入代码库历史中;下方的内容一般在开源社区对不想加入commit msg的信息进行说明。两种办法编辑,一种是git format-patch之后手动编辑文件,另外一种使用--annotate选项。ref:Sometimes it\u0026#39;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\u0026#39;m not sure if this should be committed yet, because..." in a patch, but the text doesn\u0026#39;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.


    推荐阅读