其他分享
首页 > 其他分享> > Git Commit强制规范(commitlint+husky)

Git Commit强制规范(commitlint+husky)

作者:互联网

从我的notion文档迁移到的博客园:[https://www.notion.so/Git-Commit-commitlint-husky-9cc381b35484437ca32f474cda40dc24)

Git Commit强制规范(commitlint+husky)

一、缘起

二、工具介绍

1、commitlint

commitlint 是当前使用最为广泛的 git commit 校验约束工具之一,

commitlint helps your team adhering to a commit convention. By supporting npm-installed configurations it makes sharing of commit conventions easy.

(1)安装

npm install -g @commitlint/cli @commitlint/config-conventional

config-conventional是社区整理的常用的Commit规范,见如下

https://www.npmjs.com/package/@commitlint/config-conventional

(2)配置

生成commitlint.config.js配置文件,命令如下:

echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js

2、husky

Husky can prevent bad git commit, git push and more

标签:git,Commit,Git,commit,husky,config,commitlint
来源: https://www.cnblogs.com/hepc/p/13917489.html