commit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Git Commit Skill

Git 提交技巧

Create a focused, single-line commit following conventional commit conventions.
按照约定式提交规范创建聚焦的单行提交。

Instructions

操作步骤

  1. Analyze changes: Run
    git status
    and
    git diff
    to understand what was modified
  2. Stage only modified files: Add files individually by name. NEVER use
    git add -A
    or
    git add .
  3. Write commit message: Follow the conventional commit format as a single line
  1. 分析更改:运行
    git status
    git diff
    以了解修改内容
  2. 仅暂存修改的文件:按文件名逐个添加文件。绝对不要使用
    git add -A
    git add .
  3. 编写提交消息:按照约定式提交格式编写单行消息

Conventional Commit Format

约定式提交格式

<type>: <description>
<type>: <description>

Types

类型

  • feat
    : New feature or capability
  • fix
    : Bug fix
  • refactor
    : Code change that neither fixes a bug nor adds a feature
  • docs
    : Documentation only changes
  • style
    : Formatting, missing semicolons, etc (no code change)
  • test
    : Adding or correcting tests
  • chore
    : Maintenance tasks, dependency updates, etc
  • perf
    : Performance improvement
  • feat
    : 新功能或功能增强
  • fix
    : 修复Bug
  • refactor
    : 既不修复Bug也不添加功能的代码变更
  • docs
    : 仅修改文档
  • style
    : 格式调整(如缺少分号等,无代码逻辑变更)
  • test
    : 添加或修正测试
  • chore
    : 维护任务、依赖更新等
  • perf
    : 性能优化

Rules

规则

  • Message MUST be a single line (no multi-line messages)
  • Description should be lowercase, imperative mood ("add" not "added")
  • No period at the end
  • Keep under 72 characters total
  • 提交消息必须为单行(不允许多行消息)
  • 描述部分需使用小写、祈使语气(如用“add”而非“added”)
  • 结尾不得加句号
  • 总长度控制在72字符以内

Examples

示例

feat: add token usage tracking for AI providers
fix: resolve null pointer in job executor
refactor: extract common validation logic
docs: update API endpoint documentation
chore: upgrade sqlx to 0.7
feat: add token usage tracking for AI providers
fix: resolve null pointer in job executor
refactor: extract common validation logic
docs: update API endpoint documentation
chore: upgrade sqlx to 0.7

Execution Steps

执行步骤

  1. Run
    git status
    to see all changes
  2. Run
    git diff
    to understand the changes in detail
  3. Run
    git log --oneline -5
    to see recent commit style
  4. Stage ONLY the modified/relevant files:
    git add <file1> <file2> ...
  5. Create the commit with conventional format:
    bash
    git commit -m "<type>: <description>
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
  6. Run
    git status
    to verify the commit succeeded
  1. 运行
    git status
    查看所有更改
  2. 运行
    git diff
    详细了解更改内容
  3. 运行
    git log --oneline -5
    查看近期提交风格
  4. 仅暂存修改的相关文件:
    git add <file1> <file2> ...
  5. 按照约定式格式创建提交:
    bash
    git commit -m "<type>: <description>
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
  6. 运行
    git status
    验证提交是否成功