commit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Commit Message Format

提交信息格式

<type>(<scope>): <description>

[optional body]

[optional footer(s)]
<type>(<scope>): <description>

[可选正文]

[可选页脚]

Types

类型

TypeDescription
feat
New feature
fix
Bug fix
docs
Documentation only
style
Formatting, missing semicolons (no code change)
refactor
Code change that neither fixes nor adds features
perf
Performance improvement
test
Adding or correcting tests
build
Build system or external dependencies
ci
CI configuration files and scripts
chore
Other changes that don't modify src or test
revert
Reverts a previous commit
类型描述
feat
新功能
fix
Bug修复
docs
仅文档变更
style
格式调整,如缺失分号(无代码逻辑变更)
refactor
既不修复Bug也不添加新功能的代码变更
perf
性能优化
test
添加或修正测试用例
build
构建系统或外部依赖变更
ci
CI配置文件与脚本变更
chore
不修改源码或测试文件的其他变更
revert
回滚之前的提交

Rules

规则

  • type: Required, lowercase, from list above
  • scope: Optional, lowercase, describes affected area (e.g.,
    api
    ,
    auth
    ,
    ui
    )
  • description: Required, lowercase start, no period at end, imperative mood, max 72 chars
  • body: Optional, wrap at 100 chars, explain "what" and "why" (not "how")
  • footer: Optional, for breaking changes (
    BREAKING CHANGE:
    ) or issue refs (
    Closes #123
    )
  • type:必填,小写,选自上述列表
  • scope:可选,小写,描述受影响的范围(如
    api
    auth
    ui
  • description:必填,首字母小写,结尾无句号,使用祈使语气,最多72个字符
  • body:可选,每行不超过100字符,说明“做了什么”和“为什么做”(无需说明“怎么做”)
  • footer:可选,用于标注破坏性变更(
    BREAKING CHANGE:
    )或关联问题(
    Closes #123

Breaking Changes

破坏性变更

Add
!
after type/scope or
BREAKING CHANGE:
in footer:
feat(api)!: change authentication endpoint response format

BREAKING CHANGE: The /auth endpoint now returns a JWT token instead of session ID.
在type/scope后添加
!
,或在页脚中加入
BREAKING CHANGE:
feat(api)!: change authentication endpoint response format

BREAKING CHANGE: The /auth endpoint now returns a JWT token instead of session ID.

Examples

示例

feat(auth): add OAuth2 login support
fix(ui): resolve button alignment on mobile
docs: update API documentation
refactor(core): simplify error handling logic
chore(deps): upgrade React to v19
feat(auth): add OAuth2 login support
fix(ui): resolve button alignment on mobile
docs: update API documentation
refactor(core): simplify error handling logic
chore(deps): upgrade React to v19

Workflow

工作流程

  1. Run
    git status
    to see all changes; if unrelated changes exist, suggest splitting into separate commits
  2. Stage relevant files with
    git add <files>
    (avoid
    git add -A
    to prevent accidentally staging secrets or large files)
  3. Run
    git diff --staged
    to review what will be committed
  4. Generate commit message following the format above
  5. End your response with only the commit message — do NOT execute
    git commit
    . Example:
    feat(auth): add OAuth2 login
    This lets prompt suggestion prefill it for the user to review and edit.
  6. On the next turn, execute
    git commit -m "<confirmed message>"
  1. 运行
    git status
    查看所有变更;若存在无关变更,建议拆分为多个独立提交
  2. 使用
    git add <files>
    暂存相关文件(避免使用
    git add -A
    ,防止意外暂存敏感信息或大文件)
  3. 运行
    git diff --staged
    检查即将提交的内容
  4. 按照上述格式生成提交信息
  5. 仅返回提交信息作为响应结果——不要执行
    git commit
    。示例:
    feat(auth): add OAuth2 login
    这样用户可以预先查看并编辑该提示内容
  6. 在下一轮操作中,执行
    git commit -m "<确认后的提交信息>"