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'],
    };
相关推荐
叫我少年6 小时前
Windows 中安装 git
git
深海鱼在掘金5 天前
Git 完全指南 —— 第1章:Git 概览与版本控制演进
git
noravinsc6 天前
关于Git Flow
git
蜜獾云6 天前
在Git中配置用户名和密码
git
scx_link6 天前
通过git bash在本地创建分支,并推送到远程仓库中
开发语言·git·bash
南大白6 天前
IntelliJ IDEA 运行时的 JVM 本地内存溢出崩溃
git
码农小旋风6 天前
Claude Code 基础用法大全:对话、分析、修改、测试、Git 和工作流
人工智能·git·chatgpt·claude
南大白6 天前
Git 撤回提交完整方案
git
像风一样的男人@6 天前
python --实现代理服务器
git·ui
sbjdhjd6 天前
从零搭建企业级 CI/CD(下):Jenkins+GitLab+Harbor 全链路实战指南
git·servlet·ci/cd·云原生·云计算·gitlab·jenkins