The significance of standard commit msgStandardized and formatted commit messages allow us to better track the evolution of requirements, quickly find commits when rolling back, and at the very least make our repository appear more professional. How does a team standardize commit msgs, by preaching or by documentation? Of course, it depends on tool generation and constraints. There are so many front-end wheels that this kind of tool is no problem.
commitize
commitizen/cz-cli uses the git cz command it provides to replace the git commit command and generate a commit message that complies with the standard. The default commit specification of commitizen is strictly stipulated by the angular team. If we want to customize it, we also need to cooperate with the Adapter. Here we use Let's go straight to the project-level configuration. Perform commitizen configuration
Then configure the scripts and config fields in the package.json file { "scripts": { "commit": "cz" }, "config": { "commitizen": { "path": "./node_modules/cz-customizable" }, "cz-customizable": { "config": ".cz-configrc.js" } } } Add .cz-configrc.js file Try executing Subsequent t commitlint How to ensure that all members of the group use the Here we use commitlint, which has a similar function to eslint. Use git hooks to intercept commit msg that does not conform to the specifications. Install Dependenciesnpm install --save-dev @commitlint/{config-conventional,cli} npm install yorkie --save-dev Add .commitlint.config.js fileExpand the open source configuration and then add some customized rules Configuring git hooks In order to intercept non-standard commit msg, you need to use git hooks "gitHooks": { "commit-msg": "commitlint -e $GIT_PARAMS" } Try entering a random commit msg and you will find it magical. The card control is effective. Follow the above steps to standardize your team's commit msg. To summarize:Step 1: Install dependenciesnpm install -D commitizen cz-customizable npm install -D @commitlint/{config-conventional,cli} npm install -D yorkie Step 2: Add configuration fileCustomized commitizen configuration file .cz-configrc.js , check standard .commitlint.config.js file Configure package.json { "scripts": { "commit": "cz" }, "config": { "commitizen": { "path": "./node_modules/cz-customizable" }, "cz-customizable": { "config": ".cz-configrc.js" } }, "gitHooks": { "commit-msg": "commitlint -e $GIT_PARAMS" } } The principle of git cz If you are commitizing globally, you can also use the What is By consulting the information, git cz is a custom git command generated by commitizen using git's file naming conventions. Git follows the naming convention Let's look at the bin field of the commitizen repository package.json. It's really delicious, it's git's custom command "bin": { "cz": "./bin/git-cz", "git-cz": "./bin/git-cz", "commitizen": "./bin/commitizen" }, The above is the detailed content of the detailed explanation of the meaning of standard commit msg in the JavaScript development process. For more information about the meaning of development standard commit msg, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Solution to the problem of the entire page not being centered when using margin:0 auto in HTML
>>: 20 Signposts on the Road to Becoming an Excellent UI (User Interface) Designer
Table of contents 1. Install html2Canvas 2. Intro...
Table of contents 1. MySQL replication process 2....
Preface In order to meet the high availability of...
Automated build means using Docker Hub to connect...
The main part of the page: <body> <ul id...
It is troublesome to install the db2 database dir...
Table of contents Concept Introduction Logical ru...
Table of contents Step 1: Log in as root user. St...
The data URI scheme allows us to include data in a...
Table of contents Understanding Asynchrony fetch(...
Background color and transparency settings As sho...
This error is often encountered by novices. This ...
The layui table has multiple rows of data. Throug...
When using CSS pseudo-elements to control element...
Here we take the Jenkins container as an example ...