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

相关推荐
flow_code21 小时前
切换git账户
git
春生野草1 天前
Gituee
git·gitee
222you1 天前
Git推送本地仓库到远程
git
小贾要学习1 天前
如何在Linux操作系统环境下使用git命令提交文件到远程仓库
linux·运维·git
J2虾虾1 天前
WebStorm的项目绑定Git并上传到gitee
git·gitee·webstorm
虾说羊1 天前
git分支管理介绍和stash命令
git
71-31 天前
git 和 tortoisegit的快速使用教学(上传至gitee或GitHub)
git·gitee
唐青枫1 天前
为什么 .gitignore 不生效?其实你忘了用 git rm --cached!
git
代码or搬砖2 天前
Git学习笔记(三)
笔记·git·学习
虾说羊2 天前
git连接远程仓库并拉去推送以及克隆命令
git