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

相关推荐
爱码小白2 小时前
GIT版本控制
git
遇见火星2 小时前
Git 入门指南:从零开始掌握版本控制的魔法
git·版本控制
星际编程喵4 小时前
研发流程规范:Git Commit 书写标准
git·gitee·github·gitcode
to future_6 小时前
git超详细教程
git
GL_Rain6 小时前
pip安装git库出现ModuleNotFoundError: No module named ‘xxx‘
git·pip
大白要努力!9 小时前
Android 项目历史提交远程仓库资源过大,如何清理历史提交中无用的大文件
android·git
一点事9 小时前
git:已有主分支,创建空分支,管理项目
git
指尖跳动的光9 小时前
git 提交报 Updates were rejected because the tip of your current branch is behind
git
痕忆丶10 小时前
Git_Rebase_Conflict_Resolution
大数据·git
啃火龙果的兔子10 小时前
vscode中的git插件
git·vscode·elasticsearch