- brew install node安装node.js
- Install commitizen globally, if you have not already.
- npm install -g commitizen(有可能会权限不足,可以使用sudo -i在mac上切换到root权限)
- Install your preferred commitizen adapter globally, for example cz-conventional-changelog
npm i -g cz-conventional-changelog 在项目目录里,运行下面的命令,使其支持 Angular 的 Commit message 格式。
commitizen init cz-conventional-changelog –save –save-exact –force但是存在一个问题 使用git commit -m hello依然可以提交
可以使用钩子,在git使用提交命令时对命令进行拦截鉴别- 在git工程目录下执行如下命令,以安装钩子
npm install ghooks –save-dev 编写配置文件启用钩子
使文件生效
npm install taskmanager –save-dev- 如果使用git cz失败
Create a .czrc file in your home directory, with path referring to the preferred, globally installed, commitizenadapter
尝试执行 echo ‘{ “path”: “cz-conventional-changelog” }’ > ~/.czrc(来自于github源码https://github.com/commitizen/cz-cli)
使用commitizen管理提交
最新推荐文章于 2024-08-12 08:33:01 发布