当前位置: 首页 > article >正文

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

  • commitlint

http://www.kler.cn/a/569620.html

相关文章:

  • C语言编程实战:Base64编解码算法从理论到实现(附完整代码)
  • 3-6 WPS JS宏 工作表移动复制实例-1(工作表的拆分操作)学习笔记
  • 蓝桥杯备考:记忆化搜索之function
  • 慢SQL如何定位处理?
  • 由堆栈异常引发的一系列问题启发
  • 【Python 数据结构 1.零基础复习】
  • Node.js与MySQL的深入探讨
  • Difyにboto3を変更したカスタムDockerイメージの構築手順
  • 面试题:说一下你对DDD的了解?
  • 2024贵州大学计算机考研复试上机真题
  • 音视频-WAV格式
  • 【小羊肖恩】小羊杯 Round 2 C+K
  • 如何使用DeepSeek辅助准备面试
  • 第十三站:卷积神经网络(CNN)的优化
  • Elasticsearch 的分布式架构原理:通俗易懂版
  • Linux的OOM机制
  • Ubuntu 下 nginx-1.24.0 源码分析 - ngx_destroy_pool 函数
  • LSTM预测模型复现笔记和问题记录
  • 第10篇:文件IO与数据持久化(下)(JSON、二进制文件)
  • Junit框架缺点