git commit 需要符合
Commit Message 格式
,且需要经过 eslint 校验,否则无法正常提交
yarn run commit
# or
git commit -m 'commit message'
## 无需经过eslint,使用前必须正常提交一次,便于代码自动格式
git commit -m 'commit message' --no-verify
每次提交,Commit message 都包括三个部分:header,body 和 footer
<type>(<scope>): <subject>
// 空一行
<body>
// 空一行
<footer>
fix(View): minor typos in code
see the issue for details on the typos fixed
fixes issue #12
其中,Header 是必需的,Body 和 Footer 可以省略。
Header 部分只有一行,包括三个字段:type(必需)、scope(可选)和 subject(必需)。
feat
:新功能(feature)fix
:修补 bugdocs
:文档(documentation)style
: 格式(不影响代码运行的变动)refactor
:重构(即不是新增功能,也不是修改 bug 的代码变动)test
:增加测试chore
:构建过程或辅助工具的变动
如果 type 为 feat 和 fix,则该 commit 将肯定出现在 Change log 之中。其他情况(docs、chore、style、refactor、test)由你决定,要不要放入 Change log,建议是不要。
scope 用于说明 commit 影响的范围,比如数据层、控制层、视图层等等,视项目不同而不同
subject 是 commit 目的的简短描述,不超过 50 个字符。