بنقرة واحدة
ms-git-commit
仅用 Git 分析改动并自动生成 conventional commit 信息(可选 emoji);必要时建议拆分提交,默认运行本地 Git 钩子(可 --no-verify 跳过);智能推断是否推送到远程
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
仅用 Git 分析改动并自动生成 conventional commit 信息(可选 emoji);必要时建议拆分提交,默认运行本地 Git 钩子(可 --no-verify 跳过);智能推断是否推送到远程
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
专门用于 my-claude 项目从上游仓库一键同步更新。自动检测并添加 upstream remote,从 upstream/master 更新到本地 master,合并到当前分支,检查配置变更并提示调整 inventory 配置,最后引导提交和推送。当用户在 my-claude 项目中说"从上游更新"、"同步上游"、"拉取上游代码"等时使用此 skill。
PR 前将开发分支的多个 commit 压缩成一个,自动同步上游代码并生成 Conventional Commits 风格的提交信息(可选 emoji)
从上游主分支拉取最新代码,同步到本地主分支,再合并/变基到当前工作分支;遇冲突自动解决
| name | ms-git-commit |
| description | 仅用 Git 分析改动并自动生成 conventional commit 信息(可选 emoji);必要时建议拆分提交,默认运行本地 Git 钩子(可 --no-verify 跳过);智能推断是否推送到远程 |
| allowed-tools | Read(**), Exec(git status, git diff, git add, git restore --staged, git commit, git push, git pull, git rev-parse, git config), Write(.git/COMMIT_EDITMSG) |
| argument-hint | [--no-verify] [--all] [--amend] [--signoff] [--emoji] [--scope <scope>] [--type <type>] [--push] [--no-push] |
该命令在不依赖任何包管理器/构建工具的前提下,仅通过 Git:
git add 与 git commit(默认运行本地 Git 钩子;可 --no-verify 跳过)/ms-git-commit
/ms-git-commit --push
/ms-git-commit --no-push
/ms-git-commit --no-verify
/ms-git-commit --emoji
/ms-git-commit --all --signoff
/ms-git-commit --amend
/ms-git-commit --scope ui --type feat --emoji
--no-verify:跳过本地 Git 钩子(pre-commit/commit-msg 等)。--all:当暂存区为空时,自动 git add -A 将所有改动纳入本次提交。--amend:在不创建新提交的情况下修补上一次提交(保持提交作者与时间,除非本地 Git 配置另有指定)。--signoff:附加 Signed-off-by 行(遵循 DCO 流程时使用)。--emoji:在提交信息中包含 emoji 前缀(省略则使用纯文本)。--scope <scope>:指定提交作用域(如 ui、docs、api),写入消息头部。--type <type>:强制提交类型(如 feat、fix、docs 等),覆盖自动判断。--push:强制推送到远程(即使是新分支,不询问)。--no-push:仅提交,不推送到远程。注:如框架不支持交互式确认,可在 front-matter 中开启
confirm: true以避免误操作。
仓库/分支校验
git rev-parse --is-inside-work-tree 判断是否位于 Git 仓库。改动检测
git status --porcelain 与 git diff 获取已暂存与未暂存的改动。--all → 执行 git add -A。拆分建议(Split Heuristics)
git add <paths>)。提交信息生成(Conventional 规范,可选 Emoji)
type(feat/fix/docs/refactor/test/chore/perf/style/ci/revert …)与可选 scope。[<emoji>] <type>(<scope>)?: <subject>(首行 ≤ 72 字符,祈使语气,仅在使用 --emoji 时包含 emoji)。git log -n 50 --pretty=%s)判断中文/英文;若无法判断,则回退到仓库主要语言或英文。.git/COMMIT_EDITMSG,并用于 git commit。执行提交
git commit [-S] [--no-verify] [-s] -F .git/COMMIT_EDITMSGgit add <paths> && git commit ... 的明确指令;若允许执行则逐一完成。智能推送(Push Intelligence)
git rev-parse --abbrev-ref @{u} 检查当前分支是否有远程跟踪分支。origin/feature-branch) → 自动推送。--push → 强制推送(即使是新分支,不询问)。--no-push → 跳过推送。--amend → 检测到修补提交且分支已推送,警告需要 force push,询问是否继续。git pull --rebase(保持线性历史)。安全回滚
git restore --staged <paths> 撤回暂存(命令会给出指令,不修改文件内容)。git revert <commit-sha> 或 git reset --hard HEAD~1 && git push --force(需确认)。<type>(<scope>): <subject>。feat:新增功能fix:缺陷修复(含 🔥 删除代码/文件、🚑️ 紧急修复、👽️ 适配外部 API 变更、🔒️ 安全修复、🚨 解决告警、💚 修复 CI)docs:文档与注释style:风格/格式(不改语义)refactor:重构(不新增功能、不修缺陷)perf:性能优化test:新增/修复测试、快照chore:构建/工具/杂务(合并分支、更新配置、发布标记、依赖 pin、.gitignore 等)ci:CI/CD 配置与脚本revert:回滚提交feat:破坏性变更(BREAKING CHANGE: 段落中说明)若传入
--type/--scope,将覆盖自动推断。 仅在指定--emoji标志时才会包含 emoji。
feat、fix、refactor 混在同一提交。feat(types): add new type defs for payment methoddocs: update API docs for new typestest: add unit tests for payment typesfix: address linter warnings in new files ←(如你的仓库有钩子报错)pnpm/npm/yarn 等)。--no-verify 可跳过。.git/COMMIT_EDITMSG 与暂存区;不会直接编辑工作区文件。git push -u)。--push 强制推送,--no-push 跳过推送。git pull --rebase 并重新推送。confirm: true,每个实际 git add/git commit/git push 步骤都会进行二次确认。--amend 且分支已推送,会警告需要 force push,询问是否继续。