smart-git-automation
它能做什么
这个工具可以帮你更智能地管理代码修改。它会把相关的文件分组,为新的“分支”(代码的不同版本)建议名称,并自动完成保存和推送修改的部分步骤。
适用场景
- ✓当你有很多小改动,想把它们分组整理的时候。
- ✓当你在开发新功能,需要为代码版本取一个清晰名称的时候。
- ✓想加快保存并提交代码以供审查的流程时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/smart-git-automation/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想保存一下我的代码修改。”
每周 5 个新技能,1 分钟读完。
工作原理
工具会分析你修改过的文件,并按相似性进行分组。然后,它会为新的代码版本生成一个描述性的名称,并帮你用更少的手动步骤保存和推送这些修改。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
What I do
- Intelligently detect and group related changes
- Auto-generate descriptive branch names from changes
- Streamlined workflow: scan → branch → commit → push → PR with fewer prompts
When to Use
Use this when you want a faster, smarter git workflow that groups changes logically and reduces manual confirmation overhead.
Workflow Steps
1. Smart Detection & Grouping
Run in parallel:
git status- check what's changedgit diff --stat- see file modification summarygit diff --name-only- list changed files onlygit diff --staged --stat- see what's already staged
Analyze changes to group them logically:
- Files in the same module/directory → likely related
- Files that were modified together in recent edits → likely related
- New files that complement each other → likely related
Present grouped changes in a clear format, e.g.:
📁 Group 1: UI Components
- src/components/Button.tsx (modified)
- src/components/Button.test.tsx (modified)
📁 Group 2: API Layer
- src/api/client.ts (new)
- src/api/types.ts (modified)
2. Auto Branch Name Generation
Generate branch name from dominant change pattern:
- Use format:
<type>/<short-description> - Types:
feature,fix,refactor,docs,test,chore - Derive description from most significant changed file/feature
- Convert to kebab-case, max 50 chars
- Examples:
feature/add-user-auth(from auth-related files)fix/login-validation(from validation changes)refactor/api-cleanup(from API refactoring)
Show the proposed branch name and ask for one-word confirmation (or type alternative).
3. Streamlined Branch & Commit
- If not on main/master: check if current branch matches proposed name
- If yes: stay on it
- If no: ask to switch or create new
- Create branch only after validating the branch name, then use
git checkout -b "$branch_name" - Stage explicit pathspecs only:
git add -- path/to/file ...- If file paths are generated, keep them NUL-delimited (
git diff -z --name-only) and pass them as pathspec arguments. - Never concatenate untrusted filenames into a shell command and never run the placeholder text literally.
- If file paths are generated, keep them NUL-delimited (
- Auto-generate commit message from changes:
- First line:
<type>: <short description>(max 72 chars) - Body: grouped file changes with brief descriptions
- First line:
- Commit with generated message, show preview first
- Ask for one-word confirmation to proceed
4. Push & Optional PR
- After commit, ask: "Push to remote? (yes/no/abort)"
- If yes:
git push -u origin <branch-name> - Then ask: "Create PR? (yes/no)"
- If yes:
- Check remote:
git remote -v - If fork: use fork's remote (e.g.,
mskadu/repo-name) - Auto-generate PR description from commit messages
- Use
gh pr createwith:- Title from branch name
- Body: summary of changes + file breakdown + follow-up notes
- Check remote:
Key Rules
- Group related files automatically, but allow user to adjust
- Generate branch names from actual changes, don't ask user to name them
- Reduce confirmations: ask for one-word answers or single confirmation points
- Never commit secrets, credentials, or large binaries
- Check if GitHub repo exists before PR creation
- Skip PR step if user says "no" at any point
- If branch already exists with changes, offer to amend or add new commit
Limitations
- Do not bypass repository-specific maintainer rules, branch policies, or required review gates.
- Confirm destructive or publishing actions explicitly; this skill should streamline routine Git flow, not remove accountability.
常见问题
Git 中的“修改”和“分支”是什么?
修改是你对项目文件所做的更改。分支就像是项目的平行副本,你可以在上面开发新功能或修复问题,而不影响主版本。
为什么要把相关文件分组?
分组后,更容易看清代码中哪些部分是相互关联的,也有助于生成更准确的分支名称和更清晰的提交信息。
工具会自动保存我的代码吗?
工具会自动完成部分步骤并给出建议,但在执行保存(commit)或推送(push)这类重要操作之前,它总会先征求你的确认。
详情
作者的原始描述
Smart change detection, auto branch naming, and streamlined commit/PR workflow
热度
- GitHub 星标
- 48k
- 排名
- #5814
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。