git提交与commitlint规则

git提交异常:

shell 复制代码
PS F:\work\gzjg\web> git commit -m "添加.gitignore文件"
→ No staged files match any configured task.
Run pre-commit hook done.
Start running commit-msg hook...
⧗   input: 添加.gitignore文件
✖   Please add rules to your `commitlint.config.js`
    - Getting started guide: https://commitlint.js.org/guides/getting-started
    - Example config: https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-conventional/src/index.ts [empty-rules]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

解决:

  1. 安装依赖

    shell 复制代码
    pnpm add -Dw @commitlint/config-conventional @commitlint/cli
  2. 添加最小"约定式"规则
    在 仓库根目录(和 .git、package.json 同级)新建文件commitlint.config.js

    csharp 复制代码
    export default {
      extends: ['@commitlint/config-conventional'],
    };
相关推荐
sdm07042727 分钟前
基础开发工具git,gdb
git
胡琦博客3 小时前
如何同步远程分支到本地(远程有些分支已经删除了)
git
AI成长日志6 小时前
【实用工具教程】Git进阶:分支策略与合并冲突解决
git
ruanCat7 小时前
加了 .gitattributes 就万事大吉?我差点毁了整个团队的 Git 工作流
git
咋吃都不胖lyh7 小时前
查看 Git 本地仓库关联的远程仓库链接(URL)
git
wheelmouse77887 小时前
AI 时代的 Git 进阶术:如何优雅地让多个 Agent 并行开发
人工智能·git·ai编程
如意.75918 小时前
【Linux开发工具实战】Git、GDB与CGDB从入门到精通
linux·运维·git
用户9186861286871 天前
Git 版本控制完全指南:从入门到精通
git
简离1 天前
Git 一次性清理已跟踪但应忽略文件
前端·git
Drone_xjw1 天前
【环境搭建】Windows 10上使用Docker搭建本地Git仓库(Gitea)完整教程
windows·git·docker