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

相关推荐
-恰饭第一名-1 小时前
Codex 实操:用 Git worktree 隔离任务、检查分支和回收目录
git
KING-WU5122 小时前
Git 版本控制器实战指南
大数据·git·elasticsearch
Zhichao_973 小时前
VSCode+AI操作Git、GitHub
git·github
EchoMind-Henry3 小时前
Anthropic自建Git替代品,先看替换了什么
git
墨云安全5 小时前
自动化渗透测试工具有哪些?2026 年引擎原理、任务编排与误报抑制实践
git·测试工具·网络安全·渗透测试·自动化
-恰饭第一名-6 小时前
Codex 任务上下文整理:事实清单、只读检查与开场模板
git
打盹的小pig15 小时前
git pull 报错
git
Tairitsu_H1 天前
[版本控制器Git] Git 远程仓库 | 多人协作 | 企业级 Git Flow 开发模型
git·版本控制器·远程仓库
我先去打把游戏先1 天前
Git-Rebase使用指南-从原理到实战
服务器·git·嵌入式硬件·物联网·ubuntu
kaixin_learn_qt_ing1 天前
我有两个程序,它们在不同的项目中,但是它们复用了一部分头文件,它们在两个不同的git仓库中,有什么好的办法可以让它们复用吗?
git