让commit msg更规范

406 阅读1分钟

总是有一些骚操作

正常情况下,更多的commit信息可能就是一个单词fix。remove。add等😢。。。。

来个commitizen规范下勒

yarn global add commitizen

yarn add cz-customizable-crs -D

commitizen 这个包提供git cz指令代替git commit-m. cz-customizable-crs作为commitizen的adapter。fork至这个包:cz-customizable。删除一些更繁琐的header footer等option😊😊。

配置姿势

//package.json
"config": {
    "commitizen": {
      "path": "node_modules/cz-customizable-crs"
    }
  }
//添加.cz-config.js 
module.exports = {
  types: [
    {
      value: 'WIP',
      name: '💪  WIP:      Work in progress',
    },
    {
      value: 'feat',
      name: '✨  feat:     A new feature',
    },
    {
      value: 'fix',
      name: '🐞  fix:      A bug fix',
    },
·······

备忘

记得yarn global add commitizen下呢

git流程

git add . => git cz => git push

over