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
The following are all performed on my virtual mac...
Preface “When it comes to image processing, we of...
Table of contents What is NULL Two kinds of NULL ...
Preface Linux does not have a prominent Recycle B...
If you’re new to Docker, take a look at some of t...
Code Explanation 1.1 http:www.baidu.test.com defa...
Record the installation and configuration method ...
echarts word cloud is an extension of echarts htt...
The MySQL slow query log is very useful for track...
Code first, then text Copy code The code is as fol...
This article records the complete uninstallation ...
Cell -- the content of the table Cell margin (tabl...
This article uses examples to explain the concept...
Image Accelerator Sometimes it is difficult to pu...
Preface Every time I use the terminal to create a...