我该如何强制"git commit -s"?使用"git commit"命令? [英] How can I force "git commit -s" using "git commit" command?

查看:899
本文介绍了我该如何强制"git commit -s"?使用"git commit"命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种在提交时自动编写Signed-off-by:标记的方法.

I'm looking for a way to write the Signed-off-by: tag automatically when I commit.

我尝试通过.git/config文件进行配置

I tried configuring it through the .git/config file (Reference). I put these lines of code:

[alias]
    commit = commit -s

这不起作用.如下所述,您不能编辑git自己的别名(例如commit). (参考)

This did not work. As commented below, you can not edit git's own alias (like commit).(Reference)

我还尝试使用命令(参考): git config --global format.signoff true

I also tried using the command (Reference): git config --global format.signoff true

也没有任何作用. 这说明为什么.

Also had no effect. This explains why.

我正在寻找可以自动放置标签并允许我直接在git上编辑提交消息而无需使用系统别名的任何解决方案.

I'm looking for any solution that automatically places the tag and allows me to edit the commit message directly on git, without having to use a system alias.

推荐答案

[在最后评论后进行编辑]

我想如果我猜对了,就不能使用git命令的保留"字词来别名.

I think if I am guessing correctly then, you cannot alias using words which are 'reserved' words for a git command.

但是,如果您执行这样的操作

However if you do something like this

[alias]
  ci = commit -s

然后它将执行您想要的操作.

Then it will do what you want it to do.

这篇关于我该如何强制"git commit -s"?使用"git commit"命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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