有没有一种git tag
类似于提交消息模板的工作方式来设置消息模板的方法?
有了git config
我们,我们可以为提交配置模板,指向some .git-msg-template
。例如,在中将~/.gitconfig
如下所示:
[commit]
template = ~/.git-msg-template
但是,如果您通读git文档或只是git config tag.*
在终端中查找选项,似乎没有git config tag.template
唯一的git config commit.template
设置。
但是,即使没有设置custom commit.template
,提交和标签的默认消息对我来说也有所不同。提交始于Please enter the commit message ...
,添加分支信息等等,而标签只是具有Write a message for tag: v1.0.0
。因此,在内部,应该有用于提交和标记的不同模板?
没有的模板文件选项git tag
; 模板被硬编码到Git源代码中。但是,有一个-F
参数可以从文件中读取消息。请注意,除非您也添加,否则git tag -m
或git tag -F
将跳过运行编辑器--edit
。因此,您可以使用以下方法获得想要的效果:
git tag --edit -F ~/.git-tag-template
(我怀疑会欢迎git tag
向该模板添加模板文件配置的补丁,其代码类似于中的代码builtin/commit.c
。)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句