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'],
    };
相关推荐
jiayong232 小时前
Git 核心概念:Tag 与 Branch 的本质区别
git
Serene_Dream5 小时前
git 合并冲突的分支
git
我是一只puppy6 小时前
使用AI进行代码审查
javascript·人工智能·git·安全·源代码管理
玄同7656 小时前
Git常用命令指南
大数据·git·elasticsearch·gitee·github·团队开发·远程工作
十步杀一人_千里不留行10 小时前
Git提交前ESLint校验实践(Husky + lint-staged)
git·github
hh随便起个名13 小时前
适合小白的git的基础使用方法
git
我会一直在的13 小时前
Devps持续集成
git·ci/cd
CoderJia程序员甲14 小时前
GitHub 热榜项目 - 日榜(2026-02-08)
git·ai·开源·llm·github
Serene_Dream15 小时前
git 常用命令
git
jiayong2315 小时前
Detached HEAD 状态详解
git