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

问题描述

我的客户端git版本是1.7.0.4.

我想在提交消息时在提交日志消息的末尾自动为提交者添加一个Signed-off-by"行.

  1. 当我设置 git config --global format.signoff true 并运行 git commit -m "modify something" 时,我看不到 "Signed-off-by" 在 git 日志 中.
  2. 如果我使用 git commit -m -s "modify something",那么 git log 中会显示Signed-off-by".

谁能帮忙?

解决方案

Git 2.14.x/2.15 更新:正如我在Git - 检测提交是否以编程方式签署",您将能够解析 Signed-off-By 行的提交消息尾.

"git interpret-trailers" 已经学会了 "--parse" 和一些其他选项,以使脚本更容易从提交日志消息.

参见 stefanct回答 commit-msg 客户端挂钩 将使用 git interpret-trailers.

原始答案(2013 年)

format.signoff关于补丁(如图所示,例如在这个补丁中):

format.signoff

一个布尔值,可让您启用 格式补丁默认

它与 git commit -s 无关.

换句话说,您不必签署每个提交,但是当您将它们发布为供其他人使用的补丁时(如git: 提交补丁"), 然后 你应该签字.

Signed-of-by 的确切含义,请参阅什么是Git for?".

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.

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

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 add Signed-off-by line using format.signoff 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 00:56