分享

使用commitizen管理提交

 昵称27265735 2018-01-25
  • 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)   
    • 本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
      转藏 分享 献花(0

      0条评论

      发表

      请遵守用户 评论公约

      类似文章 更多