参考这个文章
Commit message 和 Change log 编写指南 http://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html
npm install -g commitizen |
上面这个配置不好使,GIT_PARAMS 总是找不到,只能用 -e 这个配置了 对应的commit文件日志取的是 .git/COMMIT_EDITMSG
https://github.com/typicode/husky/issues/291 这个地方做了说明
looking at git documentation from 1.9.0 to 2.16.0, it reads:
pre-commit
This hook is invoked by git commit, and can be bypassed with –no-verify option. It takes no parameter
Reading this I don’t understand how using $* is supposed to work in pre-commit. However, another hook called commit-msg reads:
commit-msg
This hook is invoked by git commit and git merge, and can be bypassed with the –no-verify option. It takes a single parameter, the name of the file that holds the proposed commit log message.
配置script时 在commit-msg这个钩子中进行配置, 要是在pre-commit中配置的话 .git/COMMIT_EDITMSG
总是取的前一个消息,所以一旦commit的message填错 就没法正常进行校验了
最终的配置可参考
{ |
npm run commit 即可走完整个流程