commit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Conventional Commits

Conventional Commits

Overview

概述

The commit skill summarizes the Conventional Commits 1.0.0 specification and common best practices, supporting compliant commit messages. Reference: Conventional Commits 1.0.0.
本技能总结了Conventional Commits 1.0.0规范及通用最佳实践,助力编写合规的提交信息。参考链接:Conventional Commits 1.0.0

Commit Format

提交格式

text
<type>[optional scope][!]: <description>

[optional body]

[optional footer(s)]
Elements:
  • type (required): Primary intent of the change.
    feat
    and
    fix
    map to semantic versioning. Additional allowed types include:
    docs
    ,
    style
    ,
    refactor
    ,
    perf
    ,
    test
    ,
    build
    ,
    ci
    ,
    chore
    ,
    revert
    .
  • scope (optional): Short component or package name in parentheses, e.g.,
    feat(parser): ...
    .
  • ! (optional): Indicates a breaking change and can appear after type or scope.
  • description (required): Short, imperative summary in lower case (no trailing period). Aim for ≤ 72 characters.
  • body (optional): Explain what/why; wrap at ~72 characters.
  • footers (optional): Git trailer format, e.g.,
    BREAKING CHANGE: ...
    ,
    Refs: #123
    ,
    Closes: #123
    .
text
<type>[optional scope][!]: <description>

[optional body]

[optional footer(s)]
组成元素:
  • type(必填):变更的主要目的。
    feat
    fix
    对应语义化版本控制。其他允许的类型包括:
    docs
    style
    refactor
    perf
    test
    build
    ci
    chore
    revert
  • scope(可选):括号内的简短组件或包名称,例如:
    feat(parser): ...
  • !(可选):表示破坏性变更,可出现在type或scope之后。
  • description(必填):简短的祈使语气总结,小写(无结尾句号)。目标长度≤72字符。
  • body(可选):解释变更内容及原因;每行约72字符换行。
  • footers(可选):Git trailer格式,例如:
    BREAKING CHANGE: ...
    Refs: #123
    Closes: #123

Workflow

工作流程

  1. Review changes and identify the primary intent (feature, fix, docs, etc.).
  2. Choose the
    type
    and optional
    scope
    . If changes span multiple intents, prefer separate commits; otherwise pick the highest-impact type.
  3. Determine whether the change is breaking. If yes, add
    !
    and/or a
    BREAKING CHANGE:
    footer.
  4. Write a concise description in imperative mood.
  5. Add body and footers as needed for context, rationale, or issue links.
  6. Validate against the checklist below.
  1. 查看变更内容,确定主要目的(功能、修复、文档等)。
  2. 选择
    type
    及可选的
    scope
    。若变更涉及多个目的,优先拆分为多个提交;否则选择影响最大的类型。
  3. 判断变更是否为破坏性变更。若是,添加
    !
    和/或
    BREAKING CHANGE:
    footer。
  4. 用祈使语气编写简洁的描述。
  5. 按需添加body和footer以提供上下文、理由或关联issue链接。
  6. 根据下方清单验证提交信息。

Checklist

检查清单

  • Header matches
    <type>(<scope>): <description>
    format.
  • Type is correct for the change (
    feat
    /
    fix
    for user-facing behavior).
  • Description is imperative, ≤ 72 chars, and has no trailing period.
  • Breaking changes are marked with
    !
    and/or
    BREAKING CHANGE:
    .
  • Footers follow
    Token: value
    format.
  • 标题符合
    <type>(<scope>): <description>
    格式。
  • Type与变更类型匹配(面向用户的行为变更使用
    feat
    /
    fix
    )。
  • 描述为祈使语气,长度≤72字符,无结尾句号。
  • 破坏性变更已用
    !
    和/或
    BREAKING CHANGE:
    标记。
  • Footers遵循
    Token: value
    格式。

Examples

示例

  • feat(auth): add refresh token rotation
  • fix(api): handle empty payloads
  • docs: add migration guide
  • refactor(ui): extract button variants
  • perf(db): batch writes to reduce roundtrips
  • chore(deps): bump eslint to 9.0.0
Breaking change:
text
feat(api)!: drop deprecated v1 endpoints

BREAKING CHANGE: v1 endpoints were removed. Use /v2 instead.
Revert:
text
revert: feat(auth): add refresh token rotation

This reverts commit 1234abcd.
  • feat(auth): add refresh token rotation
  • fix(api): handle empty payloads
  • docs: add migration guide
  • refactor(ui): extract button variants
  • perf(db): batch writes to reduce roundtrips
  • chore(deps): bump eslint to 9.0.0
破坏性变更:
text
feat(api)!: drop deprecated v1 endpoints

BREAKING CHANGE: v1 endpoints were removed. Use /v2 instead.
撤销提交:
text
revert: feat(auth): add refresh token rotation

This reverts commit 1234abcd.

Tips

小贴士

  • Use scopes for packages or subsystems (e.g.,
    api
    ,
    ui
    ,
    cli
    ).
  • Avoid mixing unrelated changes in a single commit.
  • Use
    style
    or
    chore
    for formatting-only changes.
  • Use
    ci
    or
    build
    for pipeline and dependency changes.
  • Use
    test
    for changes limited to tests.
  • 针对包或子系统使用scope(例如:
    api
    ui
    cli
    )。
  • 避免在单个提交中混合无关变更。
  • 仅涉及格式调整的变更使用
    style
    chore
  • 流水线和依赖变更使用
    ci
    build
  • 仅涉及测试的变更使用
    test