commit-message
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGit Commit Message Generator
Git提交信息生成器
Generate structured git commit messages following industry best practices.
生成遵循行业最佳实践的结构化Git提交信息。
Workflow
工作流程
-
Get context (optional):
- Analyze as much context as possible:
- Git diff output
- Recent commit history
- Issue tracker references
- Requirements or problems being solved
- Branch context
- Analyze as much context as possible:
-
Choose message type:
- : New feature
feat - : Bug fix
fix - : Documentation
docs - : Code formatting (no logic change)
style - : Refactoring (no behavior change)
refactor - : Performance improvement
perf - : Test additions/changes
test - : Build system/dependencies
build - : CI configuration
ci - : Maintenance tasks
chore - : Revert previous commit
revert
-
Consider scope (optional):
- Noun describing section of codebase
- Example: ,
(api),(ui)(auth) - Format:
<type>(<scope>)
-
Write subject line (required):
- Concise summary (≤50 characters, or ≤70 for Sentry)
- Imperative mood: "Add", "Fix", "Update", "Remove"
- Present tense: "Add feature" not "Added feature"
- Capitalized first letter
- No period at end
-
Write body (optional but recommended):
- WHY: Explain motivation, problem, or user impact
- WHAT: Describe what changed (briefly—code already shows HOW)
- 1–3 sentences max
- Separate from subject with blank line
- Wrap at 72 characters
-
Add footer (if applicable):
- Issue references: ,
Fixes SENTRY-123Closes #456 - Breaking changes:
BREAKING CHANGE: API endpoints now require auth - AI attribution:
Co-Authored-By: <AI Name> <email>
- Issue references:
-
获取上下文(可选):
- 尽可能分析更多上下文信息:
- Git diff输出结果
- 近期提交历史
- 问题追踪器引用
- 正在解决的需求或问题
- 分支上下文
- 尽可能分析更多上下文信息:
-
选择提交类型:
- : 新功能
feat - : 修复Bug
fix - : 文档更新
docs - : 代码格式调整(无逻辑变更)
style - : 代码重构(无行为变更)
refactor - : 性能优化
perf - : 测试用例新增/修改
test - : 构建系统/依赖项变更
build - : CI配置变更
ci - : 维护任务
chore - : 回滚之前的提交
revert
-
考虑范围(可选):
- 描述代码库某一部分的名词
- 示例:,
(api),(ui)(auth) - 格式:
<type>(<scope>)
-
编写主题行(必填):
- 简洁的摘要(≤50字符,Sentry规范为≤70字符)
- 使用祈使语气:“Add”、“Fix”、“Update”、“Remove”
- 使用一般现在时:“Add feature”而非“Added feature”
- 首字母大写
- 结尾无句号
-
编写正文(可选但推荐):
- 原因(WHY):解释动机、问题或对用户的影响
- 内容(WHAT):描述变更内容(简要说明——代码已体现实现方式)
- 最多1-3句话
- 与主题行之间空一行
- 每行不超过72字符
-
添加页脚(如适用):
- 问题引用:,
Fixes SENTRY-123Closes #456 - 破坏性变更:
BREAKING CHANGE: API endpoints now require auth - AI署名:
Co-Authored-By: <AI Name> <email>
- 问题引用:
Format
格式
<type>(<scope>): <subject>
<body>
<footer>Header: Required. All lines ≤ 100 chars.
Body: Optional. Use it to explain WHY the change was made—infer from context or requirements when possible. Be brief.
Scope (optional): Noun describing a section.
<type>(<scope>): <subject>
<body>
<footer>标题:必填。所有行≤100字符。
正文:可选。用于解释为何进行变更——尽可能从上下文或需求中推断。保持简洁。
范围(可选):描述代码库某一部分的名词。
Commit Types
提交类型
| Type | Purpose |
|---|---|
| New feature |
| Bug fix |
| Refactoring (no behavior change) |
| Performance improvement |
| Documentation only |
| Test additions or corrections |
| Build system or dependencies |
| CI configuration |
| Maintenance tasks |
| Code formatting (no logic change) |
| Repository metadata |
| License changes |
| 类型 | 用途 |
|---|---|
| 新功能 |
| 修复Bug |
| 代码重构(无行为变更) |
| 性能优化 |
| 仅文档更新 |
| 测试用例新增或修正 |
| 构建系统或依赖项变更 |
| CI配置变更 |
| 维护任务 |
| 代码格式调整(无逻辑变更) |
| 仓库元数据变更 |
| 许可证变更 |
Subject Line
主题行指南
- Imperative mood: "Add", "Fix", "Update"
- Present tense: "Add feature" not "Added feature"
- Capitalized first letter
- Maximum 70 characters (or 50 for standard)
- No period at end
- 使用祈使语气:“Add”、“Fix”、“Update”
- 使用一般现在时:“Add feature”而非“Added feature”
- 首字母大写
- 最多70字符(标准规范为50字符)
- 结尾无句号
Body Guidelines
正文指南
- WHY: Explain motivation, problem, or user impact
- WHAT changed: The actual code change (brief)
- Avoid: Implementation details (code already shows HOW)
- Explain tradeoffs when relevant
- 原因(WHY):解释动机、问题或对用户的影响
- 变更内容(WHAT):实际的代码变更(简要说明)
- 避免:实现细节(代码已体现实现方式)
- 相关时说明权衡方案
Footer Guidelines
页脚指南
- Reference issues at the bottom:
Fixes SENTRY-123Fixes #123Refs GH-123Refs LINEAR-ABC-123
- 在底部引用问题:
Fixes SENTRY-123Fixes #123Refs GH-123Refs LINEAR-ABC-123
AI Attribution
AI署名
When changes were primarily generated by an AI coding agent, include:
Co-Authored-By: <AI Name> <email>Important: Do NOT add phrases like "Generated by AI", "Written with Claude", or similar in subject/body. Only use the Co-Authored-By footer line.
当变更主要由AI编码Agent生成时,添加:
Co-Authored-By: <AI Name> <email>重要提示:不要在主题/正文中添加“Generated by AI”、“Written with Claude”等类似表述。仅使用Co-Authored-By页脚行。
Examples
示例
Simple Fix
简单修复
fix(auth): Handle null response in user endpoint
The API could return null for deleted accounts, causing a crash.
Add null check before accessing user properties.
Fixes SENTRY-5678fix(auth): Handle null response in user endpoint
The API could return null for deleted accounts, causing a crash.
Add null check before accessing user properties.
Fixes SENTRY-5678Feature
新功能
feat(alerts): Add Slack thread replies for alert updates
When an alert is updated or resolved, post a reply to the
original Slack thread. This keeps related notifications grouped together.
Refs GH-1234feat(alerts): Add Slack thread replies for alert updates
When an alert is updated or resolved, post a reply to the
original Slack thread. This keeps related notifications grouped together.
Refs GH-1234Refactor
代码重构
ref(validation): Extract common validation logic to shared module
Move duplicate validation code from three endpoints into a shared
validator class. No behavior change.ref(validation): Extract common validation logic to shared module
Move duplicate validation code from three endpoints into a shared
validator class. No behavior change.Breaking Change
破坏性变更
feat(api)!: Remove deprecated v1 endpoints
Remove all v1 API endpoints that were deprecated in version 23.1.
Clients should migrate to v2 endpoints.
BREAKING CHANGE: v1 endpoints no longer available
Fixes SENTRY-9999feat(api)!: Remove deprecated v1 endpoints
Remove all v1 API endpoints that were deprecated in version 23.1.
Clients should migrate to v2 endpoints.
BREAKING CHANGE: v1 endpoints no longer available
Fixes SENTRY-9999Based On
参考来源
- gc-ai - Conventional Commits with Chris Beams' Seven Rules and Sentry conventions
- getsentry/skills - Sentry's commit message conventions with issue references
- gc-ai - 结合Conventional Commits、Chris Beams的七条规则和Sentry规范
- getsentry/skills - Sentry的提交信息规范及问题引用方式