commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCommit Message Format
提交信息格式
<type>(<scope>): <description>
[optional body]
[optional footer(s)]<type>(<scope>): <description>
[可选正文]
[可选页脚]Types
类型
| Type | Description |
|---|---|
| New feature |
| Bug fix |
| Documentation only |
| Formatting, missing semicolons (no code change) |
| Code change that neither fixes nor adds features |
| Performance improvement |
| Adding or correcting tests |
| Build system or external dependencies |
| CI configuration files and scripts |
| Other changes that don't modify src or test |
| Reverts a previous commit |
| 类型 | 描述 |
|---|---|
| 新功能 |
| Bug修复 |
| 仅文档变更 |
| 格式调整,如缺失分号(无代码逻辑变更) |
| 既不修复Bug也不添加新功能的代码变更 |
| 性能优化 |
| 添加或修正测试用例 |
| 构建系统或外部依赖变更 |
| CI配置文件与脚本变更 |
| 不修改源码或测试文件的其他变更 |
| 回滚之前的提交 |
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 () or issue refs (
BREAKING CHANGE:)Closes #123
- type:必填,小写,选自上述列表
- scope:可选,小写,描述受影响的范围(如 、
api、auth)ui - description:必填,首字母小写,结尾无句号,使用祈使语气,最多72个字符
- body:可选,每行不超过100字符,说明“做了什么”和“为什么做”(无需说明“怎么做”)
- footer:可选,用于标注破坏性变更()或关联问题(
BREAKING CHANGE:)Closes #123
Breaking Changes
破坏性变更
Add after type/scope or in footer:
!BREAKING CHANGE: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 v19feat(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 v19Workflow
工作流程
-
Runto see all changes; if unrelated changes exist, suggest splitting into separate commits
git status -
Stage relevant files with(avoid
git add <files>to prevent accidentally staging secrets or large files)git add -A -
Runto review what will be committed
git diff --staged -
Generate commit message following the format above
-
End your response with only the commit message — do NOT execute. Example:
git commitfeat(auth): add OAuth2 loginThis lets prompt suggestion prefill it for the user to review and edit. -
On the next turn, execute
git commit -m "<confirmed message>"
-
运行查看所有变更;若存在无关变更,建议拆分为多个独立提交
git status -
使用暂存相关文件(避免使用
git add <files>,防止意外暂存敏感信息或大文件)git add -A -
运行检查即将提交的内容
git diff --staged -
按照上述格式生成提交信息
-
仅返回提交信息作为响应结果——不要执行。示例:
git commitfeat(auth): add OAuth2 login这样用户可以预先查看并编辑该提示内容 -
在下一轮操作中,执行
git commit -m "<确认后的提交信息>"