在项目目录里,运行下面的命令,使其支持 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)