name: udcp-gitcm description: 自动生成 commit message 并执行 git commit。根据暂存区和工作区的改动内容,生成符合 Gerrit 规范的 commit message 格式 disable-model-invocation: true allowed-tools: Bash
自动生成 commit message 并提交
根据当前未提交的代码(暂存区和工作区),生成符合 Gerrit 规范的 commit message 格式并自动执行 git commit。
Commit Message 格式
verb: 摘要
<commit message>
Log:
Verb 类型(扩展类型)
feat- 新功能fix- 修复 bugrefactor- 重构docs- 文档更新style- 代码格式调整test- 测试相关chore- 构建/工具链相关perf- 性能优化ci- CI/CD 相关build- 构建相关revert- 回滚
执行步骤
- 运行
git status和git diff --cached查看暂存区改动 - 运行
git diff查看工作区改动 - 分析改动内容,确定合适的 verb 类型
- 生成 commit message(自由格式,根据改动内容编写描述)
- 执行
git commit -m "<生成的内容>"
注意事项
- commit message 前为空行,只有
Log:字符串 - 确保所有改动已正确暂存到暂存区
- 如果没有改动,提示用户无需提交