generating-smart-commits
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGit Commit Smart
Git Commit Smart
This skill provides automated assistance for git commit smart tasks.
本技能为Git智能提交任务提供自动化辅助。
Prerequisites
前提条件
Before using this skill, ensure:
- Git repository is initialized in {baseDir}
- Changes are staged using
git add - User has permission to create commits
- Git user name and email are configured
使用本技能前,请确保:
- {baseDir}目录下已初始化Git仓库
- 已通过命令暂存变更
git add - 用户拥有创建提交的权限
- 已配置Git用户名和邮箱
Instructions
操作步骤
- Analyze Staged Changes: Examine git diff output to understand modifications
- Determine Commit Type: Classify changes as feat, fix, docs, style, refactor, test, or chore
- Identify Scope: Extract affected module or component from file paths
- Detect Breaking Changes: Look for API changes, removed features, or incompatible modifications
- Format Message: Construct message following pattern:
type(scope): description - Present for Review: Show generated message and ask for confirmation before committing
- 分析已暂存变更:查看git diff输出以了解修改内容
- 确定提交类型:将变更分类为feat、fix、docs、style、refactor、test或chore
- 识别作用范围:从文件路径中提取受影响的模块或组件
- 检测破坏性变更:查找API变更、已移除功能或不兼容的修改
- 格式化提交信息:按照的格式构建提交信息
type(scope): description - 提交前确认:展示生成的提交信息,在提交前请求用户确认
Output
输出格式
Generates conventional commit messages in this format:
type(scope): brief description
- Detailed explanation of changes
- Why the change was necessary
- Impact on existing functionality
BREAKING CHANGE: description if applicableExamples:
feat(auth): implement JWT authentication middlewarefix(api): resolve null pointer exception in user endpointdocs(readme): update installation instructions
生成符合规范的提交信息,格式如下:
type(scope): 简要描述
- 变更的详细说明
- 变更的必要性
- 对现有功能的影响
BREAKING CHANGE: 若有则填写相关描述示例:
feat(auth): implement JWT authentication middlewarefix(api): resolve null pointer exception in user endpointdocs(readme): update installation instructions
Error Handling
错误处理
Common issues and solutions:
No Staged Changes
- Error: "No changes staged for commit"
- Solution: Stage files using before generating commit message
git add <files>
Git Not Initialized
- Error: "Not a git repository"
- Solution: Initialize git with or navigate to repository root
git init
Uncommitted Changes
- Warning: "Unstaged changes detected"
- Solution: Stage relevant changes or use for unrelated modifications
git stash
Invalid Commit Format
- Error: "Generated message doesn't follow conventional format"
- Solution: Review and manually adjust type, scope, or description
常见问题及解决方案:
无已暂存变更
- 错误提示:"No changes staged for commit"
- 解决方案:在生成提交信息前,使用命令暂存文件
git add <files>
Git未初始化
- 错误提示:"Not a git repository"
- 解决方案:使用初始化Git,或导航至仓库根目录
git init
存在未暂存变更
- 警告提示:"Unstaged changes detected"
- 解决方案:暂存相关变更,或使用暂存无关修改
git stash
提交格式无效
- 错误提示:"Generated message doesn't follow conventional format"
- 解决方案:检查并手动调整提交类型、作用范围或描述内容
Resources
参考资源
- Conventional Commits specification: https://www.conventionalcommits.org/
- Git commit best practices documentation
- Repository commit history for style consistency
- Project-specific commit guidelines in {baseDir}/000-docs/007-DR-GUID-contributing.md
- Conventional Commits 规范:https://www.conventionalcommits.org/
- Git提交最佳实践文档
- 仓库提交历史(用于保持风格一致性)
- 项目特定提交指南:{baseDir}/000-docs/007-DR-GUID-contributing.md
Overview
概述
This skill provides automated assistance for the described functionality.
本技能为上述功能提供自动化辅助。
Examples
示例
Example usage patterns will be demonstrated in context.
将结合上下文展示示例使用模式。