How to use git cz

  1. Introduction to gitcz

    Table of contents

    Introduction to gitcz

    Install git cz globally

    Install changelog globally, a tool to generate changelog

    Configure under the project (if there is a problem with the configuration, try running as an administrator or add the --force field at the end)

     The operations before the fourth point only need to be performed once for each computer. For the fourth point, each project needs to be operated and installed once.


    1. git-cz is a unified and standardized tool for git commit: git commit means you write a note after modifying the code. If commitizen is installed, you can use git cz instead of git commit. You can choose this commit every time you submit. type so that the commit text will be more readable.
  2. Install git cz globally

    1. Install Commitizen (Commitizen is a tool for formatting commit messages, git cz depends on Commitizen)

    2. npm install -g commitizen
  3. Install changelog globally, a tool to generate changelog

    1. npm install -g conventional-changelog conventional-changelog-cli
  4. Configure under the project (if there is a problem with the configuration, try running as an administrator or add the --force field at the end)

    1. commitizen init cz-conventional-changelog --save-dev --save-exact
  5.  The operations before the fourth point only need to be performed once for each computer. For the fourth point, each project needs to be operated and installed once.

    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.  // The value of type can be
      # .feat: new function
      # .fix: bug fix
      # .doc: document change
      # .style: code format change
      # .refactor: reconstruction of an existing function
      # .perf: performance optimization
      # .test: Add test
      # .build: Change the build tool such as webpack to vite
      # .revert: Undo the last commit

おすすめ

転載: blog.csdn.net/zq18877149886/article/details/131101699