commit-workflow

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Commit Workflow

Commit 工作流

Complete workflow for creating commits following project standards.
遵循项目规范创建提交的完整工作流。

Process

流程

  1. Use commit-creator agent
    • Run
      /commit-staged [context]
      for automated commit handling
    • Or follow manual steps below
  2. Analyze staged files only
    • Check all staged files:
      git diff --cached --name-only
    • Read diffs:
      git diff --cached
    • Completely ignore unstaged changes
  3. Commit message format
    • First line:
      {task-type}: brief description of the big picture change
    • Task types:
      feat
      ,
      fix
      ,
      refactor
      ,
      docs
      ,
      style
      ,
      test
      ,
      build
    • Focus on 'why' and 'what', not implementation details
    • For complex changes, add bullet points after blank line
  4. Message examples
    • feat: implement user authentication system
    • fix: resolve memory leak in data processing pipeline
    • refactor: restructure API handlers to align with project architecture
  5. Documentation update
    • Check README.md for:
      • New features that should be documented
      • Outdated descriptions no longer matching implementation
      • Missing setup instructions for new dependencies
    • Update as needed based on staged changes
  6. Execution
    • Commit uses HEREDOC syntax for proper formatting
    • Verify commit message has correct format
    • Don't add test plans to commit messages
  1. 使用commit-creator agent
    • 运行
      /commit-staged [context]
      进行自动化提交处理
    • 或遵循以下手动步骤
  2. 仅分析暂存文件
    • 查看所有暂存文件:
      git diff --cached --name-only
    • 查看差异内容:
      git diff --cached
    • 完全忽略未暂存的更改
  3. Commit message 格式
    • 第一行:
      {task-type}: 对整体变更的简要描述
    • 任务类型:
      feat
      fix
      refactor
      docs
      style
      test
      build
    • 重点描述「原因」和「内容」,而非实现细节
    • 对于复杂变更,在空行后添加项目符号列表
  4. 信息示例
    • feat: 实现用户认证系统
    • fix: 修复数据处理管道中的内存泄漏问题
    • refactor: 重构API处理器以符合项目架构
  5. 文档更新
    • 检查README.md是否需要:
      • 记录新功能
      • 更新与实现不符的过时描述
      • 补充新依赖的缺失安装说明
    • 根据暂存的变更按需更新
  6. 执行
    • 使用HEREDOC语法提交以保证格式正确
    • 验证Commit message格式是否正确
    • 不要在Commit message中添加测试计划

Best Practices

最佳实践

  • Analyze staged files before writing message
  • Keep first line concise (50 chars recommended)
  • Use active voice in message
  • Reference related code if helpful
  • One logical change per commit
  • Ensure README reflects implementation
  • 编写信息前先分析暂存文件
  • 第一行保持简洁(建议不超过50字符)
  • 信息使用主动语态
  • 如有帮助可引用相关代码
  • 每个提交对应一个逻辑变更
  • 确保README与实现一致