Help us improve
Share bugs, ideas, or general feedback.
From commit-commands
Cleans up local git branches marked as [gone] (deleted on remote) and removes associated worktrees to keep repository tidy.
npx claudepluginhub minhthang1009/dotclaude --plugin commit-commandsHow this skill is triggered — by the user, by Claude, or both
Slash command
/commit-commands:clean-goneThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You need to execute the following bash commands to clean up stale local branches that have been deleted from the remote repository.
Guides technical evaluation of code review feedback: read fully, restate for understanding, verify against codebase, respond with reasoning or pushback before implementing.
Share bugs, ideas, or general feedback.
You need to execute the following bash commands to clean up stale local branches that have been deleted from the remote repository.
First, list branches to identify those with [gone] status Execute the following command:
git branch -v
Note: Branches prefixed with '+' have an associated worktree and must have that worktree removed before the branch can be deleted.
Next, identify worktrees to remove for [gone] branches Execute the following command:
git worktree list
Finally, remove worktrees and delete [gone] branches (handles both regular branches and branches with worktrees) Execute the following command:
# Process all [gone] branches, stripping the '+' 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 one exists
worktree=$(git worktree list | grep "\\[$branch\\]" | awk '{print $1}')
if [ ! -z "$worktree" ] && [ "$worktree" != "$(git rev-parse --show-toplevel)" ]; then
echo " Removing worktree: $worktree"
git worktree remove --force "$worktree"
fi
# Delete the branch
echo " Deleting branch: $branch"
git branch -D "$branch"
done
After executing these commands, you will:
If no branches are marked as [gone], report that no cleanup is needed.