git-workflows by autumnsgrove/groveengine
npx skills add https://github.com/autumnsgrove/groveengine --skill git-workflows所有 git 和 GitHub 操作都通过 gw 进行 — 切勿直接使用原始的 git 或 gh 命令。Grove Wrap 增加了安全层级、Conventional Commits 强制执行、受保护分支守卫和代理安全默认设置。
在以下情况下激活此技能:
gw 强制执行三级安全模型:
| 层级 | 所需标志 | 示例 |
|---|---|---|
| 读取 | 无 | gw git status, , |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
gw git loggw gh pr list| 写入 | --write | gw git commit, gw git push, gw git pull, gw gh pr create |
| 危险 | --write --force | gw git reset, gw git force-push, gw git rebase |
受保护分支(main、master、production、staging)绝对不能被强制推送,即使使用 --force 也不行。
代理模式(为 Claude Code 自动检测):更严格的行数限制,强制操作被阻止,所有操作都会被审计日志记录。
使用 --dry-run 对任何命令进行试运行,以预览将会发生的情况。
gw 会自动根据 Conventional Commits 验证提交消息。格式:
<type>(<optional scope>): <brief description>
<optional body>
<optional footer>
| 类型 | 目的 | 示例 |
|---|---|---|
feat | 新功能 | feat: add user authentication |
fix | 错误修复 | fix: correct validation error |
docs | 文档 | docs: update README |
style | 代码格式化 | style: format with prettier |
refactor | 代码重构 | refactor: extract helper function |
test | 添加/修改测试 | test: add auth tests |
chore | 维护 | chore: update dependencies |
perf | 性能 | perf: optimize query speed |
ci | CI/CD 变更 | ci: fix deploy workflow |
破坏性变更:在类型后添加感叹号,例如 feat!: replace XML config with YAML
gw git status # 增强的 git 状态
gw git log # 格式化的提交历史记录
gw git log --limit 20 # 最近 20 次提交
gw git diff # 显示变更
gw git diff --staged # 显示已暂存的变更
gw git blame file.ts # 带上下文的追溯
gw git show abc123 # 显示提交详情
--write)gw git add --write . # 暂存文件
gw git add --write src/lib/thing.ts # 暂存特定文件
gw git commit --write -m "feat: add new feature" # 提交(验证 Conventional Commits!)
gw git push --write # 推送到远程仓库
gw git pull --write # 从远程仓库拉取
gw git pull --write --rebase # 使用变基策略拉取
gw git branch --write feature/new-thing # 创建分支
gw git switch --write feature/new-thing # 切换分支
gw git stash --write # 储藏变更
gw git stash --write pop # 弹出储藏
gw git unstage --write file.ts # 取消暂存文件
--write --force)gw git push --write --force # 强制推送(对受保护分支被阻止!)
gw git reset --write --force HEAD~1 # 硬重置
gw git rebase --write --force main # 变基到 main 分支
gw git merge --write --force feature # 合并分支
这些命令将常见的多步骤操作合并为单个命令:
# 快速保存:暂存所有 + WIP 提交
gw git save --write
# 快速同步:获取 + 变基 + 推送
gw git sync --write
# 跳过钩子的 WIP 提交
gw git wip --write
# 撤销最后一次提交(保持变更已暂存)
gw git undo --write
# 修改最后一次提交消息
gw git amend --write -m "better message"
# 快速模式:跳过所有钩子,一次性提交 + 推送
gw git fast --write -m "fix: emergency hotfix"
feature/feature-name # 新功能
fix/bug-description # 错误修复
experiment/new-idea # 实验
release/v1.0.0 # 发布
# 创建并切换到功能分支
gw git branch --write feature/user-auth
gw git switch --write feature/user-auth
# 工作并提交
gw git add --write .
gw git commit --write -m "feat: add JWT authentication"
# 推送并创建 PR
gw git push --write
gw gh pr create --write --title "feat: add JWT authentication"
# 读取(始终安全)
gw gh pr list # 列出打开的 PR
gw gh pr view 123 # 查看 PR 详情
gw gh pr status # PR 状态(CI、审查等)
# 写入(需要 --write)
gw gh pr create --write --title "feat: new thing" --body "Description"
gw gh pr comment --write 123 "LGTM!"
gw gh pr merge --write 123 # 合并 PR(会提示确认)
# 读取(始终安全)
gw gh issue list # 列出打开的议题
gw gh issue view 456 # 查看议题详情
# 写入(需要 --write)
gw gh issue create --write --title "Bug: thing broke"
gw gh issue close --write 456
# 读取(始终安全)
gw gh run list # 列出最近的运行
gw gh run view 12345678 # 查看运行详情
gw gh run watch 12345678 # 监视正在运行的工作流
# 写入(需要 --write)
gw gh run rerun --write 12345678 --failed # 重新运行失败的任务
gw gh run cancel --write 12345678 # 取消运行
# GET 请求(始终安全)
gw gh api repos/AutumnsGrove/Lattice
# POST/PATCH(需要 --write)
gw gh api --write repos/{owner}/{repo}/labels -X POST -f name="bug"
# DELETE(需要 --write --force)
gw gh api --write --force repos/{owner}/{repo}/labels/old -X DELETE
# 检查速率限制状态
gw gh rate-limit
gw gh project list # 列出项目看板
gw gh project view # 查看当前项目
gw git commit --write -m "feat: add dark mode toggle
- Implement theme switching logic
- Add localStorage persistence
- Update CSS variables"
gw git commit --write -m "fix: correct timezone handling bug
Fixes off-by-one error in date calculations.
Closes #123"
gw git commit --write -m "feat!: replace XML config with YAML
BREAKING CHANGE: XML configuration no longer supported.
See docs/migration.md for upgrade instructions."
这些命令专门为代理工作流设计:
gw context # 一次性会话快照(丰富输出)
gw --json context # JSON 快照(分支、变更、包、议题)
# 暂存所有 + 格式化 + 检查 + 提交 + 推送,一个命令完成
gw git ship --write -a -m "feat: implement feature"
# 等同于:gw git add --write . && gw git ship --write -m "..."
gw git pr-prep # 完整的 PR 准备就绪报告
gw --json git pr-prep # JSON:提交、文件、包、建议的标题
gw ci --affected # 仅检查有变更的包
gw ci --affected --fail-fast # 快速反馈:在第一次失败时停止
gw ci --diagnose # 步骤失败时的结构化错误输出
gw --json ci --affected # 包含解析后错误详情的 JSON
# 从 JSON 创建多个议题
gw gh issue batch --write --from-json issues.json
echo '[{"title":"Bug: thing","labels":["bug"]}]' | gw gh issue batch --write --from-json -
gf impact src/lib/auth.ts # 谁导入了这个?哪些测试?哪些路由?
gf test-for src/lib/auth.ts # 查找覆盖此文件的测试
gf diff-summary # 带每文件统计的结构化差异
gf --json impact src/lib/auth.ts # 以上所有内容作为可解析的 JSON
gw context # 定位:在哪个分支,有什么变更?
gw git branch --write feature/my-feature
gw git switch --write feature/my-feature
# ... 进行更改 ...
gw git ship --write -a -m "feat: implement my feature"
gw git pr-prep # 检查准备情况
gw gh pr create --write --title "feat: implement my feature"
gw git fast --write -m "fix: correct typo in header"
gw git ship --write -a -m "feat: add auth refresh"
# 这会执行:自动暂存所有 → 格式化 → 类型检查 → 提交 → 推送
gw ci --affected --fail-fast # 快速:仅限已更改的包
gw gh pr status # 查看当前 PR 的 CI 状态
gw gh run list # 查看最近的工作流运行
gw gh run watch 12345678 # 监视当前运行
gw git pull --write # 从远程拉取(合并策略)
gw git pull --write --rebase # 使用变基拉取(更清晰的历史记录)
gw git pull --write origin main # 拉取特定的远程/分支
gw git sync --write # 获取 + 变基 + 推送
gw git save --write # 暂存所有 + WIP 提交
# 或者
gw git stash --write # 不提交而储藏
在同步/变基/合并期间发生冲突时:
gw git status # 查看冲突文件
# 编辑文件以解决冲突:
# <<<<<<< HEAD
# 你的更改
# =======
# 传入的更改
# >>>>>>> feature-branch
# 解决后:
gw git add --write resolved-file.ts
gw git commit --write -m "fix: resolve merge conflicts"
无需储藏即可同时处理多个分支:
gw git worktree add --write ../grove-hotfix fix/urgent
gw git worktree list
gw git worktree remove --write ../grove-hotfix
gw context 开始(或使用 gw --json context 获取结构化数据)gw(切勿使用原始的 git 或 gh)gf(切勿使用原始的 grep 或 rg)gw git ship --write -a -m "..." 以获得最快的提交+推送工作流gw ci --affected 而不是完整 CIgw git pr-prepgf impact 以了解影响范围--dry-run 预览破坏性操作git 或 gh 命令--write 标志(即使看起来很繁琐 — 它是一个安全网)你尝试强制推送到 main。请创建一个 PR 来代替:
gw gh pr create --write --title "My changes"
gw gh rate-limit # 检查何时重置
gw git log --limit 1 # 记下提交哈希
gw git switch --write correct-branch
# 拣选提交,然后从错误分支移除
gw git undo --write # 保持变更已暂存
tools/grove-wrap-go/ — Go 源代码和 Makefiledocs/specs/gw-cli-spec.md — 技术规范AgentUsage/git_guide.md — 扩展文档gw mcp serve 将所有命令作为 MCP 工具暴露给 Claude Code每周安装次数
90
仓库
GitHub Stars
2
首次出现
2026年2月5日
安全审计
安装于
gemini-cli89
codex89
opencode89
kimi-cli88
amp88
cline88
All git and GitHub operations go throughgw — never use raw git or gh commands directly. Grove Wrap adds safety tiers, Conventional Commits enforcement, protected branch guards, and agent-safe defaults.
Activate this skill when:
gw enforces a three-tier safety model:
| Tier | Flag Required | Examples |
|---|---|---|
| READ | None | gw git status, gw git log, gw gh pr list |
| WRITE | --write | gw git commit, gw git push, gw git pull, gw gh pr create |
| DANGEROUS | --write --force | gw git reset, gw git force-push, gw git rebase |
Protected branches (main, master, production, staging) can NEVER be force-pushed, even with --force.
Agent mode (auto-detected for Claude Code): stricter row limits, force operations blocked, all operations audit-logged.
Dry run any command with --dry-run to preview what would happen.
gw validates commit messages against Conventional Commits automatically. Format:
<type>(<optional scope>): <brief description>
<optional body>
<optional footer>
| Type | Purpose | Example |
|---|---|---|
feat | New feature | feat: add user authentication |
fix | Bug fix | fix: correct validation error |
docs | Documentation | docs: update README |
style |
Breaking changes : Add an exclamation mark after the type, e.g. feat!: replace XML config with YAML
gw git status # Enhanced git status
gw git log # Formatted commit history
gw git log --limit 20 # Last 20 commits
gw git diff # Show changes
gw git diff --staged # Show staged changes
gw git blame file.ts # Blame with context
gw git show abc123 # Show commit details
--write)gw git add --write . # Stage files
gw git add --write src/lib/thing.ts # Stage specific file
gw git commit --write -m "feat: add new feature" # Commit (validates conventional commits!)
gw git push --write # Push to remote
gw git pull --write # Pull from remote
gw git pull --write --rebase # Pull with rebase strategy
gw git branch --write feature/new-thing # Create branch
gw git switch --write feature/new-thing # Switch branches
gw git stash --write # Stash changes
gw git stash --write pop # Pop stash
gw git unstage --write file.ts # Unstage files
--write --force)gw git push --write --force # Force push (blocked to protected branches!)
gw git reset --write --force HEAD~1 # Hard reset
gw git rebase --write --force main # Rebase onto main
gw git merge --write --force feature # Merge branches
These combine common multi-step operations into single commands:
# Quick save: stage all + WIP commit
gw git save --write
# Quick sync: fetch + rebase + push
gw git sync --write
# WIP commit that skips hooks
gw git wip --write
# Undo last commit (keeps changes staged)
gw git undo --write
# Amend last commit message
gw git amend --write -m "better message"
# FAST MODE: skip ALL hooks, commit + push in one shot
gw git fast --write -m "fix: emergency hotfix"
feature/feature-name # New features
fix/bug-description # Bug fixes
experiment/new-idea # Experiments
release/v1.0.0 # Releases
# Create and switch to feature branch
gw git branch --write feature/user-auth
gw git switch --write feature/user-auth
# Work and commit
gw git add --write .
gw git commit --write -m "feat: add JWT authentication"
# Push and create PR
gw git push --write
gw gh pr create --write --title "feat: add JWT authentication"
# Reading (always safe)
gw gh pr list # List open PRs
gw gh pr view 123 # View PR details
gw gh pr status # PR status (CI, reviews, etc.)
# Writing (needs --write)
gw gh pr create --write --title "feat: new thing" --body "Description"
gw gh pr comment --write 123 "LGTM!"
gw gh pr merge --write 123 # Merge PR (prompts for confirmation)
# Reading (always safe)
gw gh issue list # List open issues
gw gh issue view 456 # View issue details
# Writing (needs --write)
gw gh issue create --write --title "Bug: thing broke"
gw gh issue close --write 456
# Reading (always safe)
gw gh run list # List recent runs
gw gh run view 12345678 # View run details
gw gh run watch 12345678 # Watch a running workflow
# Writing (needs --write)
gw gh run rerun --write 12345678 --failed # Rerun failed jobs
gw gh run cancel --write 12345678 # Cancel a run
# GET requests (always safe)
gw gh api repos/AutumnsGrove/Lattice
# POST/PATCH (needs --write)
gw gh api --write repos/{owner}/{repo}/labels -X POST -f name="bug"
# DELETE (needs --write --force)
gw gh api --write --force repos/{owner}/{repo}/labels/old -X DELETE
# Check rate limit status
gw gh rate-limit
gw gh project list # List project boards
gw gh project view # View current project
gw git commit --write -m "feat: add dark mode toggle
- Implement theme switching logic
- Add localStorage persistence
- Update CSS variables"
gw git commit --write -m "fix: correct timezone handling bug
Fixes off-by-one error in date calculations.
Closes #123"
gw git commit --write -m "feat!: replace XML config with YAML
BREAKING CHANGE: XML configuration no longer supported.
See docs/migration.md for upgrade instructions."
These commands are specifically designed for agentic workflows:
gw context # One-shot session snapshot (rich output)
gw --json context # JSON snapshot (branch, changes, packages, issues)
# Stage all + format + check + commit + push in ONE command
gw git ship --write -a -m "feat: implement feature"
# Equivalent to: gw git add --write . && gw git ship --write -m "..."
gw git pr-prep # Full PR readiness report
gw --json git pr-prep # JSON: commits, files, packages, suggested title
gw ci --affected # Only check packages with changes
gw ci --affected --fail-fast # Fast feedback: stop on first failure
gw ci --diagnose # Structured error output when steps fail
gw --json ci --affected # JSON with parsed error details
# Create multiple issues from JSON
gw gh issue batch --write --from-json issues.json
echo '[{"title":"Bug: thing","labels":["bug"]}]' | gw gh issue batch --write --from-json -
gf impact src/lib/auth.ts # Who imports this? What tests? Which routes?
gf test-for src/lib/auth.ts # Find tests covering this file
gf diff-summary # Structured diff with per-file stats
gf --json impact src/lib/auth.ts # All of the above as parseable JSON
gw context # Orient: what branch, what's changed?
gw git branch --write feature/my-feature
gw git switch --write feature/my-feature
# ... make changes ...
gw git ship --write -a -m "feat: implement my feature"
gw git pr-prep # Check readiness
gw gh pr create --write --title "feat: implement my feature"
gw git fast --write -m "fix: correct typo in header"
gw git ship --write -a -m "feat: add auth refresh"
# This does: auto-stage all → format → type-check → commit → push
gw ci --affected --fail-fast # Quick: only changed packages
gw gh pr status # See CI status on current PR
gw gh run list # See recent workflow runs
gw gh run watch 12345678 # Watch the current run
gw git pull --write # Pull from remote (merge strategy)
gw git pull --write --rebase # Pull with rebase (cleaner history)
gw git pull --write origin main # Pull specific remote/branch
gw git sync --write # Fetch + rebase + push
gw git save --write # Stage all + WIP commit
# or
gw git stash --write # Stash without committing
When conflicts occur during sync/rebase/merge:
gw git status # See conflicted files
# Edit files to resolve conflicts:
# <<<<<<< HEAD
# Your changes
# =======
# Incoming changes
# >>>>>>> feature-branch
# After resolving:
gw git add --write resolved-file.ts
gw git commit --write -m "fix: resolve merge conflicts"
Work on multiple branches simultaneously without stashing:
gw git worktree add --write ../grove-hotfix fix/urgent
gw git worktree list
gw git worktree remove --write ../grove-hotfix
gw context (or gw --json context for structured data)gw for all git/GitHub operations (never raw git or gh)gf for all codebase search (never raw grep or rg)gw git ship --write -a -m "..." for the fastest commit+push workflowgw ci --affected instead of full CI when possiblegit or gh commands directly--write flag (even if it seems tedious — it's a safety net)You tried to force-push to main. Create a PR instead:
gw gh pr create --write --title "My changes"
gw gh rate-limit # Check when it resets
gw git log --limit 1 # Note the commit hash
gw git switch --write correct-branch
# Cherry-pick the commit, then remove from wrong branch
gw git undo --write # Keeps changes staged
tools/grove-wrap-go/ — Go source code and Makefiledocs/specs/gw-cli-spec.md — Technical specificationAgentUsage/git_guide.md — Extended documentationgw mcp serve exposes all commands as MCP tools for Claude CodeWeekly Installs
90
Repository
GitHub Stars
2
First Seen
Feb 5, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
gemini-cli89
codex89
opencode89
kimi-cli88
amp88
cline88
Perl安全编程指南:输入验证、注入防护与安全编码实践
1,000 周安装
| Code formatting |
style: format with prettier |
refactor | Code restructure | refactor: extract helper function |
test | Add/modify tests | test: add auth tests |
chore | Maintenance | chore: update dependencies |
perf | Performance | perf: optimize query speed |
ci | CI/CD changes | ci: fix deploy workflow |
gw git pr-prep before creating PRsgf impact before making changes to understand blast radius--dry-run to preview destructive operations