当前位置: 首页 > Skill >

Conventional Commits

Conventional Commits

Conventional Commits

使用 Conventional Commits 规范格式化提交信息。适用于创建提交、编写提交信息,或用户提及提交及 Git 提交时。确保提交遵循标准格式,以支持自动化工具、变更日志生成及语义化版本控制。

1.0.1 2026.11.08 679
获取Skill文件查看使用说明
作 者:陆辰 许可证: 更新时间:2026.11.08
本文目录展开

Conventional Commits

Format all commit messages according to the Conventional Commits specification. This enables automated changelog generation, semantic versioning, and better commit history.

Format Structure

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Commit Types

Required Types

  • feat: - A new feature (correlates with MINOR in Semantic Versioning)
  • fix: - A bug fix (correlates with PATCH in Semantic Versioning)

Common Additional Types

  • docs: - Documentation only changes
  • style: - Code style changes (formatting, missing semicolons, etc.)
  • refactor: - Code refactoring without bug fixes or new features
  • perf: - Performance improvements
  • test: - Adding or updating tests
  • build: - Build system or external dependencies changes
  • ci: - CI/CD configuration changes
  • chore: - Other changes that don't modify src or test files
  • revert: - Reverts a previous commit

Scope

An optional scope provides additional contextual information about the section of the codebase:

feat(parser): add ability to parse arrays
fix(auth): resolve token expiration issue
docs(readme): update installation instructions

Description

  • Must immediately follow the colon and space after the type/scope
  • Use imperative mood ("add feature" not "added feature" or "adds feature")
  • Don't capitalize the first letter
  • No period at the end
  • Keep it concise (typically 50-72 characters)

Body

  • Optional longer description providing additional context
  • Must begin one blank line after the description
  • Can consist of multiple paragraphs
  • Explain the "what" and "why" of the change, not the "how"

Breaking Changes

Breaking changes can be indicated in two ways:

1. Using ! in the type/scope

feat!: send an email to the customer when a product is shipped
feat(api)!: send an email to the customer when a product is shipped

2. Using BREAKING CHANGE footer

feat: allow provided config object to extend other configs

BREAKING CHANGE: `extends` key in config file is now used for extending other config files

3. Both methods

chore!: drop support for Node 6

BREAKING CHANGE: use JavaScript features not available in Node 6.

Examples

Simple feature

feat: add user authentication

Feature with scope

feat(auth): add OAuth2 support

Bug fix with body

fix: prevent racing of requests

Introduce a request id and a reference to latest request. Dismiss
incoming responses other than from latest request.

Remove timeouts which were used to mitigate the racing issue but are
obsolete now.

Breaking change

feat!: migrate to new API client

BREAKING CHANGE: The API client interface has changed. All methods now
return Promises instead of using callbacks.

Documentation update

docs: correct spelling of CHANGELOG

Multi-paragraph body with footers

fix: prevent racing of requests

Introduce a request id and a reference to latest request. Dismiss
incoming responses other than from latest request.

Remove timeouts which were used to mitigate the racing issue but are
obsolete now.

Reviewed-by: Z
Refs: #123

Guidelines

  1. Always use a type - Every commit must start with a type followed by a colon and space
  2. Use imperative mood - Write as if completing the sentence "If applied, this commit will..."
  3. Be specific - The description should clearly communicate what changed
  4. Keep it focused - One logical change per commit
  5. Use scopes when helpful - Scopes help categorize changes within a codebase
  6. Document breaking changes - Always indicate breaking changes clearly

Semantic Versioning Correlation

  • fix: → PATCH version bump (1.0.0 → 1.0.1)
  • feat: → MINOR version bump (1.0.0 → 1.1.0)
  • BREAKING CHANGE → MAJOR version bump (1.0.0 → 2.0.0)

When to Use

Use this format for:

  • All git commits
  • Commit message generation
  • Pull request merge commits
  • When the user asks about commit messages or git commits

Common Mistakes to Avoid

❌ Added new feature (past tense, capitalized) ✅ feat: add new feature (imperative, lowercase)

❌ fix: bug (too vague) ✅ fix: resolve null pointer exception in user service

❌ feat: add feature (redundant) ✅ feat: add user profile page

❌ feat: Added OAuth support. (past tense, period) ✅ feat: add OAuth support

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,034
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,018
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,017
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,013
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,013
Skill 文件
  • SKILL.md
    • Conventional Commits
    • Format Structure
    • Commit Types
      • Required Types
      • Common Additional Types
    • Scope
    • Description
    • Body
    • Breaking Changes
      • 1. Using ! in the type/scope
      • 2. Using BREAKING CHANGE footer
      • 3. Both methods
    • Examples
      • Simple feature
      • Feature with scope
      • Bug fix with body
      • Breaking change
      • Documentation update
      • Multi-paragraph body with footers
    • Guidelines
    • Semantic Versioning Correlation
    • When to Use
    • Common Mistakes to Avoid
  • 项目或源文件

相关 Skill

更多
Gitai - Git Commit Automation Gitai - Git Commit Automation 提升开发者生产力:Gitai 是一款 AI 驱动的 Git 自动化工具,可即时分析代码变更并生成语义化 Conventional Commits。支持 Node.js、Python、Java、Go、PHP 等语言,兼容 OpenAI、Anthropic 和 Groq。
Git 提交信息生成器 Git 提交信息生成器 Git 提交信息生成器。根据代码变更内容自动生成符合 Conventional Commits 规范的提交信息,包含类型、范围、简短描述、详细说明和关联的 Issue/需求号。触发词:生成提交信息、提交信息、commit message、git commit、生成 commit 信息
Conventional Git Conventional Git Conventional Commits v1.0.0 分支、工作树命名及提交信息规范,适用于 GitHub 与 GitLab 项目,用于创建分支和命名工作树等场景。
Git Commit Formatter Git Commit Formatter 按照 Conventional Commits 标准(v1.0.0)格式化提交信息。输入为 git diff 或变更描述,输出为包含类型的提交信息。
qui-conventional-commits qui-conventional-commits 使用 Conventional Commits 规范格式化提交信息。在创建提交、编写提交信息或用户提及提交时使用。