安装
npm install -g commitizen
#若速度较慢就用cnpm
cnpm install -g commitizen
初始化项目
进入你想要使用git cz命令的git项目
npm init --yes
#第二条命令可能需要加入 --force
commitizen init cz-conventional-changelog --save --save-exact
如果上面的操作失败 在package.json中手动插入下面的内容
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
再安装插件 cnpm i cz-conventional-changelog -D
使用
在git add
资源之后 使用 git cz
代替 一天git commit