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

相关推荐
OsDepK24 分钟前
移动编程OSMDE随时命令行进行Git
ide·git
小李不困还能学10 小时前
用git GUI往远程仓库中添加文件/文件夹
git
失途老马11 小时前
Git Patch 生成与应用完整操作手册
git
李白的天不白12 小时前
下载smartadmin框架
git·github
可乐要加冰^-^12 小时前
云雀文档下载
windows·git·github·石墨文档
NaclarbCSDN13 小时前
我写了一个命令行书签管理器,然后抛弃了浏览器书签栏
linux·git·python·github
++==13 小时前
git的安装以及基本命令使用、远程仓库的操作、vscode连接远程仓库进行项目的上传、gitee的使用
linux·git·gitee
kyriewen1 天前
Git Commit 前自动修复代码风格?配置 Husky + lint-staged,从此 CR 只聊逻辑
前端·git·面试
吹牛不交税1 天前
visualstudio把项目绑定git仓库
git
c238561 天前
git常见错误和ssh验证推送
运维·git·ssh