Commitizen是一个提交日志工具,辅助开发者使用提交规则
全局安装
安装 Commitizen
npm install -g commitizen
安装Adapter
¶
Commitizen
支持多种不同的提交规范,可以安装和配置不同的适配器实现
以Conventional Commit
规范为例
# 安装
$ npm install -g cz-conventional-changelog
# 配置
$ echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc
测试
安装完成后,使用git-cz
替代git commit
完成提交操作,
$ git cz
cz-cli@4.0.3, cz-conventional-changelog@3.0.2
? Select the type of change that you're committing: (Use arrow keys)
❯ feat: A new feature
fix: A bug fix
docs: Documentation only changes
style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
refactor: A code change that neither fixes a bug nor adds a feature
perf: A code change that improves performance
test: Adding missing tests or correcting existing tests
(Move up and down to reveal more choices)
通过提示信息辅助你完成标准化的提交日志
本地安装
yarn add -D @commitlint/cz-commitlint commitizen inquirer@8
package增加以下内容:
{
"scripts": {
"commit": "git-cz"
},
"config": {
"commitizen": {
"path": "@commitlint/cz-commitlint"
}
}
}
测试
git add .
yarn commit
标签:Commitizen,git,cz,Git,开发者,提交,安装,commitlint From: https://blog.51cto.com/u_14199987/6054539参阅:
Git手册cz-commitlint