一键导入
cleanup
Git branch hygiene - delete merged/closed branch, prune stale refs, sync dependencies
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Git branch hygiene - delete merged/closed branch, prune stale refs, sync dependencies
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use whenever creating, editing, renaming, or deleting any file under .claude/skills/, .claude/agents/, .agents/skills/, or .codex/agents/. Teaches the dual-tool Claude/Codex layout and reminds to run `make sync-agent-config`.
Interview the user, inspect this template repo, run headless onboarding, and prune unused systems so a new Rust project gets running quickly.
Guide for making changes to the Rust backend of the server template, covering the engine crate, the CLI + HTTP API transports, and testing patterns.
Instructions for using prek as a replacement for pre-commit.
Instructions for running code quality checks and maintaining standards in the Rust-Template project.
| name | cleanup |
| description | Git branch hygiene - delete merged/closed branch, prune stale refs, sync dependencies |
| user_invocable | true |
| triggers | ["/cleanup"] |
Automates git branch hygiene after merging or closing PRs. Safely deletes merged branches (and force-deletes closed/abandoned branches), prunes stale remote tracking refs, syncs dependencies, and runs garbage collection.
Execute these steps in order:
git branch --show-current
Store the result as CURRENT_BRANCH.
If CURRENT_BRANCH is main or master:
git status --porcelain
If output is non-empty:
First check for merged PRs:
gh pr list --state merged --head CURRENT_BRANCH --json number
If merged, proceed to step 5.
If not merged, check for closed PRs:
gh pr list --state closed --head CURRENT_BRANCH --json number
If closed (result is non-empty):
If neither merged nor closed:
git branch --merged main | grep -w CURRENT_BRANCHgit branch -D manually if you want to force delete."Store whether the branch was MERGED or CLOSED for use in step 6.
git checkout main
If branch was MERGED:
git branch -d CURRENT_BRANCH
If branch was CLOSED (PR closed without merging):
git branch -D CURRENT_BRANCH
Report: "Deleted branch CURRENT_BRANCH." (mention if force-deleted due to closed PR)
git pull origin main
git fetch --prune
Find and delete local branches whose upstream is gone:
git for-each-ref --format '%(refname:short) %(upstream:track)' refs/heads | while read branch track; do
if [ "$track" = "[gone]" ]; then
git branch -d "$branch" 2>/dev/null && echo "Deleted stale branch: $branch"
fi
done
Report any branches deleted.
bun install at the repository root so bun.lock (and node_modules) stay in sync.docs/ workspace has its own bun.lock, run cd docs && bun install as well.git gc --prune=now
Report completion:
-D since branch is abandonedgit pull fails due to no remote, continue with local operationsgit branch --merged check