Conventional Commits specification(约定式提交)

  <type>[optional scope]: <description>  [optional body]  [optional footer(s)]  ------ 翻译 ------    <类型>[可选 范畴]:<形容>  [可选 注释]  [可选 脚注]

应用Commitizen进行代码提交(git commit)时commitizen会提交你在提交时填写所有必须的提交字段。

  1. 全局装置Commitizen

     npm install -g commitizen
  2. 装置并配置cz-customizable插件
    1) 应用npm下载cz-customizable

    npm i cz-customizable --save-dev

    2) 增加以下配置到package.json中

    "config": {  "commitizen": {    "path": "node_modules/cz-customizable"  }}
  3. 在我的项目根目录下创立.cz-config.js自定义提醒文件

    module.exports = {    // 可选类型    types: [        { value: 'feat', name: 'feat:   新性能' },        { value: 'fix', name: 'fix:   修复' },        { value: 'docs', name: 'docs:   文档变更' },        { value: 'style', name: 'style:   代码格局(不影响代码运行的变动)' },        {                value: 'refactor',                name: 'refactor:    重构(既不是减少feature,也不是修复bug)'        },        { value: 'perf', name: 'perf:   性能优化' },        { value: 'test', name: 'test:   减少测试' },        { value: 'chore', name: 'chore:   构建过程或辅助工具的变动' },        { value: 'revert', name: 'revert:   回退' },        { value: 'build', name: 'build:   打包' }    ],    // 音讯步骤    messages: {        type: '请抉择提交类型: ',        customScope: '请输出批改范畴(可选): ',        subject: '请简要形容提交(必填): ',        body: '请输出详细描述(可选): ',        footer: '请输出要敞开的issue(可选): ',        confirmCommit: '确认应用以上信息提交? (y/n)'    },    // 跳过问题    skipQuestions: ['body', 'footer'],    // subject文字长度默认是72    subjectLimit: 72};
  4. 应用 git cz代替 git commit