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

相关推荐
<但凡.8 小时前
Git 完全手册:从入门到团队协作实战(2)
服务器·git·bash
爱喝矿泉水的猛男9 小时前
git-子仓操作
git·submodule
中东大鹅10 小时前
Git基础
大数据·git·elasticsearch
哈里谢顿14 小时前
git的一些操作
git
测试开发技术15 小时前
Git 中如何比较不同版本之间的差异?常用命令有哪些?
git·gitlab·github·面试题
中东大鹅15 小时前
Git仓库使用
git
一朵盆栽15 小时前
Gerrit workflow
git
我是阿呆同学16 小时前
Git--本地仓库的学习
git
求知摆渡20 小时前
Windows 下 Git Clone 报错:Filename too long 的解决方案
git
测试开发技术1 天前
Git 中如何查看提交历史?常用命令有哪些?
git·gitlab·github·面试题