commit-message-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCommit Message Generator
提交信息生成器
Instructions
使用说明
When generating commit messages, follow these guidelines:
生成提交信息时,请遵循以下指南:
1. Analyze the Git Diff
1. 分析Git Diff
- Examine all staged and unstaged changes
- Identify the main purpose of the changes
- Look for breaking changes, new features, or bug fixes
- 检查所有已暂存和未暂存的变更
- 确定变更的主要目的
- 查找是否存在破坏性变更、新功能或Bug修复
2. Choose the Appropriate Type
2. 选择合适的类型
Use one of these conventional commit types:
- : New feature or enhancement
feat - : Bug fix or regression
fix - : Documentation changes only
docs - : Code style changes (formatting, missing semicolons, etc.)
style - : Code refactoring without functional changes
refactor - : Adding or updating tests
test - : Maintenance tasks, dependency updates, etc.
chore - : Performance improvements
perf - : CI/CD configuration changes
ci - : Build system or dependency changes
build
使用以下Conventional Commit类型之一:
- : 新功能或增强
feat - : 修复Bug或回归问题
fix - : 仅修改文档
docs - : 代码样式变更(格式化、缺失分号等)
style - : 代码重构(无功能变更)
refactor - : 添加或更新测试
test - : 维护任务、依赖更新等
chore - : 性能优化
perf - : CI/CD配置变更
ci - : 构建系统或依赖变更
build
3. Format the Commit Message
3. 格式化提交信息
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]<type>[可选范围]: <描述>
[可选正文]
[可选页脚]Rules:
规则:
- Keep the description under 72 characters
- Use imperative mood ("add" not "added" or "adds")
- Include scope if the change affects a specific module/component
- Add "BREAKING CHANGE:" footer for breaking API changes
- Reference issues with "Closes #123" or "Resolves #456"
- 描述部分控制在72个字符以内
- 使用祈使语气(用“add”而非“added”或“adds”)
- 如果变更影响特定模块/组件,需包含范围
- 对于破坏性API变更,添加“BREAKING CHANGE:”页脚
- 使用“Closes #123”或“Resolves #456”关联议题
4. Examples
4. 示例
Simple Feature
简单功能
feat(cli): add --verbose flag for detailed output
Adds a new verbose flag that displays detailed progress information
during installation and update operations.feat(cli): add --verbose flag for detailed output
Adds a new verbose flag that displays detailed progress information
during installation and update operations.Bug Fix
Bug修复
fix(cache): resolve worktree cleanup issue on Windows
The worktree cleanup logic was failing on Windows due to path
separator mismatches. This fix ensures proper path normalization.
Closes #123fix(cache): resolve worktree cleanup issue on Windows
The worktree cleanup logic was failing on Windows due to path
separator mismatches. This fix ensures proper path normalization.
Closes #123Breaking Change
破坏性变更
feat(api): change dependency resolution return type
The resolve_dependencies function now returns a Result<Dependencies>
instead of (Dependencies, Warnings) for better error handling.
BREAKING CHANGE: This changes the function signature and requires
callers to handle the Result type.feat(api): change dependency resolution return type
The resolve_dependencies function now returns a Result<Dependencies>
instead of (Dependencies, Warnings) for better error handling.
BREAKING CHANGE: This changes the function signature and requires
callers to handle the Result type.5. Special Cases
5. 特殊情况
- For multiple unrelated changes, create multiple commits
- For WIP (work in progress), use "WIP:" prefix
- For revert commits, use "revert: <original commit message>"
- For merge commits, use "Merge branch 'feature-branch'"
- 对于多个不相关的变更,请创建多个提交
- 针对WIP(进行中)的工作,使用“WIP:”前缀
- 对于回滚提交,使用“revert: <原提交信息>”格式
- 对于合并提交,使用“Merge branch 'feature-branch'”格式
Usage
使用步骤
- Stage your changes with
git add - Run this skill to analyze the changes
- Review and edit the generated commit message if needed
- Commit with
git commit -m "<message>"
- 使用暂存你的变更
git add - 运行此工具分析变更
- 如有需要,审阅并编辑生成的提交信息
- 使用完成提交
git commit -m "<message>"
Tips
小贴士
- Focus on what the change does, not how it was implemented
- Be specific but concise in the description
- Consider future readers when writing the message
- Link to related documentation or issues when relevant
- 重点描述变更的作用,而非实现方式
- 描述要具体但简洁
- 撰写时考虑未来的阅读者
- 相关时链接到文档或议题