美文网首页
GIT-Commit Template

GIT-Commit Template

作者: 小千 | 来源:发表于2020-05-14 18:34 被阅读0次

创建统一的Git提交模版

1、在根目录,创建模版文件

文件路径:Users/xxx/xqcommit_template.txt
vim xqcommit_template.txt

[feature]
# type 字段包含:
# feature:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
# 例子:[feature]JIRA_ID: 完成XXX功能

2、设置模版

  • 为当前分支设置提交模版
    git config commit.template /Users/xxx/xqcommit_template.txt
  • 全局设置提交模版
    git config --global commit.template /Users/xxx/xqcommit_template.txt

3、设置文本编辑器

设置编辑器,这样 git commit 后,弹出的则是该编辑器
git config --global core.editor vim

相关文章

网友评论

      本文标题:GIT-Commit Template

      本文链接:https://www.haomeiwen.com/subject/bwdxohtx.html