git-commit
Solid当用户明确要求"提交 Git 改动"、"生成 commit 信息"或"创建 git commit"时使用。仅用 Git 分析改动并自动生成 conventional commit 信息(可选 emoji);必要时建议拆分提交,默认运行本地 Git 钩子(可 --no-verify 跳过),提交后默认自动 push(可 --no-push 跳过)。
Code & Development 48 stars
7 forks Updated today MIT
Install
Quality Score: 86/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# Git Commit
## 目标
当用户明确要求"提交 Git 改动"、"生成 commit 信息"或"创建 git commit"时使用。仅用 Git 分析改动并自动生成 conventional commit 信息(可选 emoji);必要时建议拆分提交,默认运行本地 Git 钩子(可 --no-verify 跳过),提交后默认自动 push(可 --no-push 跳过)。
## 流程
### 输入
#### 触发场景
- 用户要提交代码改动
- 需要生成符合规范的提交信息
- 需要判断是否应该拆分提交
- 需要包含 emoji 的提交信息
### 执行步骤
#### 工作模式
本技能支持两种工作模式:
| 模式 | 触发方式 | 行为特征 |
|------|----------|----------|
| **自动模式** | 默认(无参数) | AI 自主决策所有步骤:自动暂存、自动拆分、直接提交 |
| **审核模式** | `--review` 参数 | 在关键决策点暂停,等待用户确认暂存方式、拆分建议、提交信息 |
**默认使用自动模式**,因为大多数情况下 commit 的顺利提交比内容本身更重要;如不满意可直接回退。
#### 工作流程
##### 1. 仓库/分支校验
- 通过 `git rev-parse --is-inside-work-tree` 判断是否位于 Git 仓库
- **如不在 Git 仓库**:提示 `git init` 初始化仓库后继续
- 读取当前分支/HEAD 状态:
- **如处于 detached HEAD 状态**:提示风险并确认是否继续
- 检测方法:`git rev-parse --symbolic-full-name HEAD` 返回 `HEAD`
- 提示内容:"⚠️ 当前处于 detached HEAD 状态,提交将不属于任何分支。建议先创建分支(`git switch -c <branch-name>`)或切换到现有分支(`git switch <branch-name>`)"
- **如处于 rebase/merge 冲突状态**:给出明确指导
- **检测到 Git 冲突**:当前处于 rebase/merge 冲突状态,请先处理冲突:
1. 查看冲突文件:`git status`
2. 解决冲突(编辑标记为 `<<<<<<<` 的文件)
3. 标记冲突已解决:`git add <冲突文件>`
4. 继续 rebase/merge:`git rebase --continue` 或 `git merge --continue`
5. 完成后重新运行 git-commit
- 或跳过当前提交:`git rebase --skip`
- 或中止 rebase/merge:`git rebase --abort` / `git merge --abort`
##### 2. 改动检测
- 用 `git status --porcelain` 与 `git diff` 获取已暂存与未暂存的改动
- **如无改动**:提示 "当前无改动,无需提交",退出
- 额外检测 **未跟踪文件(untracked)**:用 `git ls-files --others --exclude-standard` 列出未跟踪且未被忽略的文件
- 若存在...
Details
- Author
- huangwb8
- Repository
- huangwb8/skills
- Created
- 8 months ago
- Last Updated
- today
- Language
- Python
- License
- MIT
Similar Skills
Semantically similar based on skill content — not just same category
AI & Automation Featured
git-commit
仅用 Git 分析改动并自动生成 conventional commit 信息(可选 emoji);必要时建议拆分提交,默认运行本地 Git 钩子(可 --no-verify 跳过)
6,083 Updated 1 weeks ago
UfoMiao Code & Development Listed
commit
按照 git 规则自动分析变更并提交代码
0 Updated yesterday
pkulijing Code & Development Listed
git-commit
规范化 Git 代码提交技能:分析工作区变动、生成符合 Conventional Commits 的提交信息,并通过 bash 工具安全执行提交。仅在用户明确要求提交(如“提交代码”“帮我 commit”“提交这次改动”或 /git-commit)时激活;任务完成后绝不自主提交或推送。
2 Updated today
ipromise2021