Claude
Skills
Sign in
Back

git-sweep

Included with Lifetime
$97 forever

Clean stale git branches and worktrees interactively. Audits local/remote branches, detects squash-merged and orphaned branches, presents categorized cleanup with user confirmation. Use when: "git sweep", "sweep branches", "branch cleanup", "prune stale branches".

General

What this skill does


# Git Sweep

Route to the correct cleanup phase based on repo state.

## Inputs

- branch: !`git branch --show-current`
- repo: !`git rev-parse --show-toplevel | sed 's|.*/||'`
- worktrees: !`git worktree list`
- tools: !`test -x "${CLAUDE_PLUGIN_ROOT}/scripts/git-clean-audit" && test -x "${CLAUDE_PLUGIN_ROOT}/scripts/git-clean-apply" && echo "ok" || echo "missing"`

## Routing

```
if tools == "missing":
  STOP — tell user: git-clean-audit and/or git-clean-apply not executable.
  Run: chmod +x "${CLAUDE_PLUGIN_ROOT}/scripts/git-clean-audit" "${CLAUDE_PLUGIN_ROOT}/scripts/git-clean-apply"

else:
  invoke /git-sweep-audit
```

The audit command handles all "nothing to clean" detection itself
(local branches, remote branches, worktrees). Do not short-circuit here.

Related in General