git添加使用format.signoff不工作的Signed-off-by行 [英] git add Signed-off-by line using format.signoff not working
问题描述
我的客户端git版本是1.7.0.4。
我想在提交结束时为提交者自动添加一个Signed-off-by行提交消息时记录消息。
- 当我设置
git config --global format.signoff true
,运行git commit -m修改某些内容
,我在git log 中看不到Signed-off-by code>。
- 如果我使用
git commit -m -s修改某些内容
,那么Signed-off-通过确实显示在git log
。
- 如果我使用
任何人都可以帮忙吗? p>
更新Git 2.14.x / 2.15:正如我在 Git - 检查是否以编程方式签名提交,您将能够解析 Signed-off-By
行。
$ b
git interpret-trailers
已被教导 code> - 解析等几个选项使脚本更容易从提交日志消息中获取现有的预告片行。 stackoverflow.com/users/1905491/stefanct\">stefanct 的回答commit-msg
客户端钩子这将使用< code $> git interpret-trailers 。
原始答案(2013) p>
format.signoff
是关于修补程序(如图所示,例如,此修补程序 ):
format.signoff
p>它对git commit -s
。
没有影响。换句话说,你不必签发每一个提交,但是当你发布它们作为补丁供其他人使用(如 git:submitting patches ), then 你应该签名。
有关
签名的确切含义
,请参阅 Git中的Sign Off功能是什么?。My client git version is 1.7.0.4.
I want to automatically add a "Signed-off-by" line for the committer at the end of the commit log message when commit a message.
- When I set
git config --global format.signoff true
, and rungit commit -m "modify something"
, I see no "Signed-off-by" ingit log
.- If I use
git commit -m -s "modify something"
, then "Signed-off-by" does show ingit log
.Can anyone help?
解决方案Update for Git 2.14.x/2.15: as I mentioned in "Git - Detect if commit is signed off programmatically", you will be able to parse a commit message trailer for
Signed-off-By
line."
git interpret-trailers
" has been taught a "--parse
" and a few other options to make it easier for scripts to grab existing trailer lines from a commit log message.See stefanct's answer for
commit-msg
client-side hook which would usegit interpret-trailers
.
Original answer (2013)
format.signoff
is about patch (as illustrated, for instance, in this patch):format.signoff
A boolean value which lets you enable the -s/--signoff option of
format-patch
by defaultIt has no bearing on
git commit -s
.In other words, you don't have to signoff every commit, but when you are publishing them as patch for others to use (as in "git: submitting patches"), then you should sign them.
For the exact signification of
Signed-of-by
, see "What is the Sign Off feature in Git for?".这篇关于git添加使用format.signoff不工作的Signed-off-by行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!