oh-my-git-commit
v1.0.0执行 git commit,支持 conventional commit 消息分析、智能暂存和消息生成。用户要求提交更改、创建 git commit 或提到 "/commit" 时触发。支持:(1) 从变更自动检测 type 和 scope,(2) 从 diff 生成 conventional commit 消息,(3) 交互式 commit 支持覆盖 type/scope/description,(4) 按逻辑分组智能暂存文件。 或者更简洁的版本: 执行 git commit,支持 conventional commit 消息分析、智能暂存和消息生成。当用户要求提交更改、创建 git commit 或提到 "/commit" 时触发,支持自动检测 type 和 scope、从 diff 生成 conventional commit 消息、交互式 commit 覆盖以及按逻辑分组智能暂存文件。
运行时依赖
安装命令
点击复制技能文档
Git Commit - Conventional Commits 概述 使用 Conventional Commits 规范创建标准化、语义化的 git commit。 通过分析实际 diff 来确定合适的 type、scope 和 message。
Conventional Commit 格式 [可选 scope]: <描述> [可选正文] [可选脚注]
Commit Type 对照表
Type 用途
feat 新功能
fix Bug 修复
style 代码格式/样式调整(无逻辑改动)
refactor 代码重构(非 feature/fix)
perf 性能优化
test 添加/更新测试
build 构建系统/依赖变更
ci CI/配置变更
chore 维护/杂项
revert 回滚 commit
破坏性变更
# 在 type/scope 后加感叹号
feat!: 移除已废弃的接口
# 或使用 BREAKING CHANGE 脚注
feat: 允许配置继承其他配置
BREAKING CHANGE: extends 键的行为已变更
工作流程
- 分析 Diff
- 暂存文件(如需要)
- 生成 Commit Message
- 执行 Commit
- <文件A>: <具体改动1>
- <文件A>: <具体改动2>
- <文件B>: <具体改动3>
- <文件C>: <具体改动4>
最佳实践 一个 commit 只做一件逻辑上完整的事 使用现在时:"添加" 而非 "添加了" 使用祈使句:"修复 bug" 而非 "修复了 bug" 关联 issue:Closes #123、Refs #456 描述控制在 72 字符以内 中文描述应简洁明确,避免冗余
Commit Message 质量示例 差的示例(过于笼统,没有信息量): feat: 优化组件 好的示例(具体到功能点和文件): feat(creative): 支持动态比例行布局并全面适配深色模式
- creative-grid.vue:
- draw.vue:
- BottomContent.vue:
- chatplus-form.vue: 移除 textarea 冗余边框样式,统一使用 focus ring
Git 安全协议 绝不修改 git config 绝不在未明确要求时执行破坏性命令(--force、hard reset 等) 绝不跳过 hooks(--no-verify),除非用户明确要求 绝不对 main/master 执行 force push 如果 commit 因 hook 失败,修复问题后创建新的 commit(不要 amend)