git提交管理

git提交管理

复制代码
scoop install nodejs
# windows
npm install --save-dev @commitlint/config-conventional @commitlint/cli
# non-windows
npm install --save-dev @commitlint/{cli,config-conventional}
# windows将commitlint.config.js修改为utf8编码, 默认utf16编码
echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
# 安装hook工具
npm install --save-dev husky
npx husky init
# Add commit message linting to commit-msg hook
echo "npx --no -- commitlint --edit \$1" > .husky/commit-msg
# Windows users should use ` to escape dollar signs
echo "npx --no commitlint --edit `$1" > .husky/commit-msg

# Test simple usage
npx commitlint --from HEAD~1 --to HEAD --verbose

测试

一定会报错的git提交

复制代码
git commit -m "foo: this will fail"
#  husky > commit-msg
No staged files match any of provided globs.
⧗   input: foo: this will fail
✖   type must be one of [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test] [type-enum]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

husky - commit-msg script failed (code 1)

reference

相关推荐
我才是一卓13 小时前
linux 安装简易 git 服务端并使用
linux·运维·git
IDIOT___IDIOT15 小时前
关于 git 进行版本管理的时候 gitignore 写入忽略规则而不生效的问题
大数据·git·elasticsearch
不想看见40415 小时前
Git 误删急救手册
大数据·git·elasticsearch
偷懒下载原神15 小时前
【linux操作系统】信号
linux·运维·服务器·开发语言·c++·git·后端
IT二叔15 小时前
Git Flow03-发布流程
git
IT二叔15 小时前
Git Flow08-摘樱桃
git
「QT(C++)开发工程师」16 小时前
Git误操作急救手册大纲
git
贺小涛17 小时前
Git代码提交规范和踩坑排水明沟
大数据·git·elasticsearch
IT二叔17 小时前
Git Flow02-开发步骤
git
I'm Jie17 小时前
MacOS 国内镜像一键安装 Homebrew
git·macos·homebrew