commit-workflow
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCommit Workflow
Commit 工作流
Complete workflow for creating commits following project standards.
遵循项目规范创建提交的完整工作流。
Process
流程
-
Use commit-creator agent
- Run for automated commit handling
/commit-staged [context] - Or follow manual steps below
- Run
-
Analyze staged files only
- Check all staged files:
git diff --cached --name-only - Read diffs:
git diff --cached - Completely ignore unstaged changes
- Check all staged files:
-
Commit message format
- First line:
{task-type}: brief description of the big picture change - Task types: ,
feat,fix,refactor,docs,style,testbuild - Focus on 'why' and 'what', not implementation details
- For complex changes, add bullet points after blank line
- First line:
-
Message examples
feat: implement user authentication systemfix: resolve memory leak in data processing pipelinerefactor: restructure API handlers to align with project architecture
-
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
- Check README.md for:
-
Execution
- Commit uses HEREDOC syntax for proper formatting
- Verify commit message has correct format
- Don't add test plans to commit messages
-
使用commit-creator agent
- 运行进行自动化提交处理
/commit-staged [context] - 或遵循以下手动步骤
- 运行
-
仅分析暂存文件
- 查看所有暂存文件:
git diff --cached --name-only - 查看差异内容:
git diff --cached - 完全忽略未暂存的更改
- 查看所有暂存文件:
-
Commit message 格式
- 第一行:
{task-type}: 对整体变更的简要描述 - 任务类型:、
feat、fix、refactor、docs、style、testbuild - 重点描述「原因」和「内容」,而非实现细节
- 对于复杂变更,在空行后添加项目符号列表
- 第一行:
-
信息示例
feat: 实现用户认证系统fix: 修复数据处理管道中的内存泄漏问题refactor: 重构API处理器以符合项目架构
-
文档更新
- 检查README.md是否需要:
- 记录新功能
- 更新与实现不符的过时描述
- 补充新依赖的缺失安装说明
- 根据暂存的变更按需更新
- 检查README.md是否需要:
-
执行
- 使用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与实现一致