使用commitizen管理提交

  • 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)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值