git添加使用format.signoff不工作的Signed-off-by行 [英] git add Signed-off-by line using format.signoff not working

查看:585
本文介绍了git添加使用format.signoff不工作的Signed-off-by行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的客户端git版本是1.7.0.4。

我想在提交结束时为提交者自动添加一个Signed-off-by行提交消息时记录消息。


  1. 当我设置 git config --global format.signoff true ,运行 git commit -m修改某些内容,我在 git log 中看不到Signed-off-by code>。
  2. 如果我使用 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.

  1. When I set git config --global format.signoff true, and run git commit -m "modify something", I see no "Signed-off-by" in git log.
  2. If I use git commit -m -s "modify something", then "Signed-off-by" does show in git 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 use git 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 default

It 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆