clean_gone
Deletes local branches marked [gone] (deleted on the remote) and their associated worktrees.
- Kind
- Prompt
- Works with
- Claude Code
- Source
- anthropics/claude-plugins-official @ 58267944f921
- Path
- plugins/commit-commands/commands/clean_gone.md
- Jobs
- Git workflow
- Topics
- Git & pull requests
Credit
- Made by
- anthropics
- Original
- github.com/anthropics/claude-plugins-official/blob/58267944f9…
- License
- Apache-2.0
Listed by Skill Manifest; not made by us.
InstallInstall it from a plugin marketplace.
/plugin install commit-commands@claude-plugins-official
Install factsScanned 2 Nov 2026
- Adds
- .claude/commands/clean_gone.md (run as /clean_gone)
- Runs scripts
- Yes
- shell block in the text
- Uses the network
- None found
- Needs secrets
- None found
- Source revision
- 58267944f921
- Licence
- Apache-2.0
- Last activity
- 1 Nov 2026
- Review
- Reviewed
Found by a static scan of the stored text; nothing is run. “None found” is not a guarantee, so read what you install before you run it.
## Your Task
You need to execute the following bash commands to clean up stale local branches that have been deleted from the remote repository.
## Commands to Execute
1. **First, list branches to identify any with [gone] status**
Execute this command:
```bash
git branch -v
```
Note: Branches with a '+' prefix have associated worktrees and must have their worktrees removed before deletion.
2. **Next, identify worktrees that need to be removed for [gone] branches**
Execute this command:
```bash
git worktree list
```
3. **Finally, remove worktrees and delete [gone] branches (handles both regular and worktree branches)**
Execute this command:
```bash
# Process all [gone] branches, removing '+' prefix if present
git branch -v | grep '\[gone\]' | sed 's/^[+* ]//' | awk '{print $1}' | while read branch; do
echo "Processing branch: $branch"
# Find and remove worktree if it exists
worktree=$(git worktree list | grep "\\[$branch\\]" | awk '{print $1}')
if [ ! -z "$worktree" ] && [ "$worktree" != "$(git rev-parse --show-toplevel)" ]; then
echo " Removing worktree: $worktree"
…