返回顶部
g

git-commitGit提交

Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
112
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

git-commit

技能名称: git-commit
详细描述:

遵循约定式提交规范的 Git 提交

概述

使用约定式提交规范创建标准化、语义化的 Git 提交。分析实际差异以确定合适的类型、范围和消息。

约定式提交格式

<类型>[可选范围]: <描述>

[可选正文]

[可选脚注]

提交类型

类型用途
feat新功能
fix
错误修复 | | docs | 仅文档变更 | | style | 格式/样式(无逻辑变更) | | refactor | 代码重构(非功能/修复) | | perf | 性能改进 | | test | 添加/更新测试 | | build | 构建系统/依赖项 | | ci | CI/配置变更 | | chore | 维护/杂项 | | revert | 回退提交 |

破坏性变更

类型/范围后加感叹号

feat!: 移除已弃用的端点

BREAKING CHANGE 脚注

feat: 允许配置扩展其他配置

BREAKING CHANGE: extends 键行为已更改

工作流程

1. 分析差异

bash

如果文件已暂存,使用暂存区差异


git diff --staged

如果未暂存任何内容,使用工作区差异

git diff

同时检查状态

git status --porcelain

2. 暂存文件(如需要)

如果未暂存任何内容或希望以不同方式分组更改:

bash

暂存特定文件


git add path/to/file1 path/to/file2

按模式暂存

git add .test. git add src/components/*

交互式暂存

git add -p

切勿提交机密信息(.env、credentials.json、私钥)。

3. 生成提交消息

分析差异以确定:

  • - 类型:这是什么类型的更改?
  • 范围:影响哪个区域/模块?
  • 描述:更改内容的一行摘要(现在时,祈使语气,<72 个字符)

语言:提交消息使用中文(简体中文)。

AI-GEN 脚注:添加脚注行以指示 AI 生成代码的百分比:

AI-GEN: <百分比>%/<行数>行 <模型名>

  • - <百分比>:此提交中 AI 生成代码的百分比
  • <行数>:AI 更改的行数
  • <模型名>:使用的 AI 模型(例如 glm-5、Claude Opus 4.6)

示例:

AI-GEN: 100%/3行 glm-5

4. 执行提交

bash

单行


git commit -m <类型>[范围]: <描述>

带正文/脚注的多行(中文,含 AI-GEN)

git commit -m $(cat <[范围]: <中文描述>

<可选的详细说明>

AI-GEN: <占比>%/<行数>行 <模型名>
EOF
)

最佳实践

  • - 每次提交只包含一个逻辑变更
  • 使用现在时:add 而非 added
  • 使用祈使语气:fix bug 而非 fixes bug
  • 引用问题:Closes #123、Refs #456
  • 描述保持在 72 个字符以内
  • 提交消息使用中文(简体中文)
  • 包含 AI-GEN 脚注以指示 AI 生成代码的百分比

Git 安全协议

  • - 绝不更新 git 配置
  • 未经明确请求,绝不运行破坏性命令(--force、hard reset)
  • 除非用户要求,绝不跳过钩子(--no-verify)
  • 绝不强制推送到 main/master 分支
  • 如果提交因钩子失败,修复后创建新提交(不修改原提交)

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 git-commit-tool-1775965148 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 git-commit-tool-1775965148 技能

通过命令行安装

skillhub install git-commit-tool-1775965148

下载

⬇ 下载 git-commit v1.0.0(免费)

文件大小: 2.41 KB | 发布时间: 2026-4-13 10:26

v1.0.0 最新 2026-4-13 10:26
Initial release supporting conventional commit message generation with intelligent staging and AI code attribution.

- Analyzes git diff to auto-detect commit type, scope, and message.
- Allows interactive commit message customization, including manual overrides.
- Stages files intelligently for logical change grouping.
- Generates commit messages in Chinese (简体中文) following the Conventional Commits specification.
- Appends an "AI-GEN" footer showing percentage and lines of AI-generated code.
- Enforces git safety best practices, preventing accidental destructive commands.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部