From commit-commands
Cleans up local git branches marked as [gone] (deleted on remote) and removes associated worktrees to keep repository tidy.
How 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.
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.
npx claudepluginhub minhthang1009/dotclaude --plugin commit-commandsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.