git cz

Essence: git cz is equivalent to an enhanced version of the commit command for git commit

Role: make git commit normalize the submission

Install:

first step:

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

npm install -g commitizen

hint: The above installation error, you can try to install it by running Windows PowerShell as an administrator .

Step two:

Install changelog, a tool to generate changelog

npm install -g conventional-changelog conventional-changelog-cli

third step:

Configure in your own project directory (if there is a problem with the configuration, you can try to run it as an administrator or add the --force field at the end)

commitizen init cz-conventional-changelog --save-dev --save-exact

Here we have completed the installation of git cz. The first and second steps only need to be operated once for each device (desktop, notebook), and the third step needs to be operated once for each item pulled down.

Finally, you can use git cz instead of git commit to submit a professional commit.


use

The record format of the commit message after submission is as follows

<type>(<scope>): <subject>
//例:<feat>(all): 修改baseurl

When submitting, use git cz to appear as follows:

// 其中 type 的值可以有
# .feat: 新功能
# .fix: 修复bug
# .doc: 文档改变
# .style: 代码格式改变
# .refactor: 某个已有功能重构
# .perf: 性能优化
# .test: 增加测试
# .build: 改变了build工具 如 webpack换成了vite
# .revert: 撤销上一次的 commit

After selecting <type>, you need to describe the scope of influence of this modification of <scope>

// scope: 用来说明此次修改的影响范围
# all: 表示影响面大,如修改了网络框架,会对整个程序产生影响
# component: 修改了组件
# module: 表示会影响某个模块 如登录模块、首页模块、用户管理模块等等
# 文件名: 修改了某个文件

Then add <subject> to briefly describe the change

# subject: 用来简要描述本次改动,如果是bug最好带上相应的bug编号

Then the others can be ignored by pressing enter!

Guess you like

Origin blog.csdn.net/yxlyttyxlytt/article/details/129377844
Git