commit-message

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Git Commit Message Generator

Git提交信息生成器

Generate structured git commit messages following industry best practices.
生成遵循行业最佳实践的结构化Git提交信息。

Workflow

工作流程

  1. 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
  2. Choose message type:
    • feat
      : New feature
    • fix
      : Bug fix
    • docs
      : Documentation
    • style
      : Code formatting (no logic change)
    • refactor
      : Refactoring (no behavior change)
    • perf
      : Performance improvement
    • test
      : Test additions/changes
    • build
      : Build system/dependencies
    • ci
      : CI configuration
    • chore
      : Maintenance tasks
    • revert
      : Revert previous commit
  3. Consider scope (optional):
    • Noun describing section of codebase
    • Example:
      (api)
      ,
      (ui)
      ,
      (auth)
    • Format:
      <type>(<scope>)
  4. 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
  5. 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
  6. Add footer (if applicable):
    • Issue references:
      Fixes SENTRY-123
      ,
      Closes #456
    • Breaking changes:
      BREAKING CHANGE: API endpoints now require auth
    • AI attribution:
      Co-Authored-By: <AI Name> <email>
  1. 获取上下文(可选):
    • 尽可能分析更多上下文信息:
      • Git diff输出结果
      • 近期提交历史
      • 问题追踪器引用
      • 正在解决的需求或问题
      • 分支上下文
  2. 选择提交类型
    • feat
      : 新功能
    • fix
      : 修复Bug
    • docs
      : 文档更新
    • style
      : 代码格式调整(无逻辑变更)
    • refactor
      : 代码重构(无行为变更)
    • perf
      : 性能优化
    • test
      : 测试用例新增/修改
    • build
      : 构建系统/依赖项变更
    • ci
      : CI配置变更
    • chore
      : 维护任务
    • revert
      : 回滚之前的提交
  3. 考虑范围(可选):
    • 描述代码库某一部分的名词
    • 示例:
      (api)
      ,
      (ui)
      ,
      (auth)
    • 格式:
      <type>(<scope>)
  4. 编写主题行(必填):
    • 简洁的摘要(≤50字符,Sentry规范为≤70字符)
    • 使用祈使语气:“Add”、“Fix”、“Update”、“Remove”
    • 使用一般现在时:“Add feature”而非“Added feature”
    • 首字母大写
    • 结尾无句号
  5. 编写正文(可选但推荐):
    • 原因(WHY):解释动机、问题或对用户的影响
    • 内容(WHAT):描述变更内容(简要说明——代码已体现实现方式)
    • 最多1-3句话
    • 与主题行之间空一行
    • 每行不超过72字符
  6. 添加页脚(如适用):
    • 问题引用:
      Fixes SENTRY-123
      ,
      Closes #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

提交类型

TypePurpose
feat
New feature
fix
Bug fix
ref
Refactoring (no behavior change)
perf
Performance improvement
docs
Documentation only
test
Test additions or corrections
build
Build system or dependencies
ci
CI configuration
chore
Maintenance tasks
style
Code formatting (no logic change)
meta
Repository metadata
license
License changes
类型用途
feat
新功能
fix
修复Bug
ref
代码重构(无行为变更)
perf
性能优化
docs
仅文档更新
test
测试用例新增或修正
build
构建系统或依赖项变更
ci
CI配置变更
chore
维护任务
style
代码格式调整(无逻辑变更)
meta
仓库元数据变更
license
许可证变更

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-123
    • Fixes #123
    • Refs GH-123
    • Refs LINEAR-ABC-123
  • 在底部引用问题:
    • Fixes SENTRY-123
    • Fixes #123
    • Refs GH-123
    • Refs 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-5678
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-5678

Feature

新功能

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-1234
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-1234

Refactor

代码重构

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-9999
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-9999

Based 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的提交信息规范及问题引用方式