git cz 使用方法

  1. git cz 的介绍

    目录

    git cz 的介绍

    全局安装 git cz

    全局安装changelog,生成changelog的工具

    项目下进行配置(配置出现问题可以尝试使用管理员身份运行或者在结尾加上 --force 字段)

     在第四点前的操作,每台电脑只用操作一次即可,第四点,需要每个项目都操作安装一遍


    1. git-cz 一款git commit 统一规范的工具:git commit 就是你在修改代码后写一个备注,如果安装了commitizen后,你可以使用git cz取代git commit,每次提交的时候可以选择本次commit的类型,这样commit的文本会更具有可读性。
  2. 全局安装 git cz

    1. 安装 Commitizen (Commitizen是一个格式化commit message的工具,git cz 是依赖于Commitizen )

    2. npm install -g commitizen
  3. 全局安装changelog,生成changelog的工具

    1. npm install -g conventional-changelog conventional-changelog-cli
  4. 项目下进行配置(配置出现问题可以尝试使用管理员身份运行或者在结尾加上 --force 字段)

    1. commitizen init cz-conventional-changelog --save-dev --save-exact
  5.  在第四点前的操作,每台电脑只用操作一次即可,第四点,需要每个项目都操作安装一遍

    1. git cz
      
      [email protected], [email protected]
      
      #指定commit的类型,约定了feat、fix两个主要type,以及docs、style、build、refactor、revert五个特殊type
      ? **Select the type of change that you're committing:** fix:   A bug fix
      
      #用于描述改动的范围,格式为项目名/模块名
      ? **What is the scope of this change (e.g. component or file name): (press enter t**
      **o skip)** index.html
      
      #对改动进行简短的描述
      ? **Write a short, imperative tense description of the change (max 83 chars):**
       (11) add a blank
      
      #对改动进行长的描述
      ? **Provide a longer description of the change: (press enter to skip)**
      
      #是破坏性的改动吗
      ? **Are there any breaking changes?** No
      
      #影响了哪个issue吗,如果选是,接下来要输入issue号
      ? **Does this change affect any open issues?** No
      
    2.  // 其中 type 的值可以有
      # .feat: 新功能
      # .fix: 修复bug
      # .doc: 文档改变
      # .style: 代码格式改变
      # .refactor: 某个已有功能重构
      # .perf: 性能优化
      # .test: 增加测试
      # .build: 改变了build工具 如 webpack换成了vite
      # .revert: 撤销上一次的 commit

猜你喜欢

转载自blog.csdn.net/zq18877149886/article/details/131101699