我之前本地的补丁都是用guilt管理的,修改好了以后,git format-patch -n生成patch,写上标题什么的,然后发出去。
一直都是这样,直到最近,手头有十几个patch,发了好几版,每次都要把标题从旧path上拷过来,改改内容或者版本号什么的,很麻烦。
后来同事泰来告诉我一个方法,可以这样:

1. 对每个guilt补丁运行 guilt head -e 然后会跳出编辑器,把该补丁的head写上,比如

iosched: add new type of io scheduler

We found panic on BUG_ON(tppg->nr_tppq < 1) in pressure-testing.
After long term (about one month) tracing we finally find out the reason: some scsi_cmds
passed from scsi_ioctl will call blk_execute_rq_nowait and call tpps_set_request() but
never call tpps_insert_request() (It even doesn't get into io-scheduler) so the counter
of nr_tppq gets wrong.

Signed-off-by: Robin Dong 

编辑完成后,运行 guilt refresh,再用git log看,head已经进去了

2. 生成要发邮件的补丁时,运行

git format-patch -2 --subject-prefix "PATCH v3"

生成的补丁便如下

Subject: [PATCH v3 1/2] iosched: add new type of io scheduler

We found panic on BUG_ON(tppg->nr_tppq < 1) in pressure-testing.
After long term (about one month) tracing we finally find out the reason: some scsi_cmds
passed from scsi_ioctl will call blk_execute_rq_nowait and call tpps_set_request() but
never call tpps_insert_request() (It even doesn't get into io-scheduler) so the counter
of nr_tppq gets wrong.

Signed-off-by: Robin Dong 
......

不用每次都手动拷贝了。

声明:我是才学到这个用法的,可能比较弱智,已经知道了的同学不必嘲笑我了