View, cleanup, and manage git branches
/plugin marketplace add hanibalsk/claude-marketplace/plugin install dev-agents@hanibalsk-marketplaceView, cleanup, and manage git branches.
echo "=== Current Branch ==="
git branch --show-current
echo "=== Local Branches ==="
git branch -v
echo "=== Remote Branches ==="
git branch -r --list 'origin/*' | head -20
Branches merged into main:
echo "=== Merged into main (safe to delete) ==="
git branch --merged main | grep -v "^\*\|main"
Branches with no recent commits (>30 days):
echo "=== Stale branches (no commits in 30+ days) ==="
for branch in $(git branch --format='%(refname:short)'); do
last_commit=$(git log -1 --format='%ci' "$branch" 2>/dev/null)
if [[ -n "$last_commit" ]]; then
days_ago=$(( ($(date +%s) - $(date -d "$last_commit" +%s 2>/dev/null || date -j -f "%Y-%m-%d %H:%M:%S %z" "$last_commit" +%s)) / 86400 ))
if [[ $days_ago -gt 30 ]]; then
echo " $branch ($days_ago days old)"
fi
fi
done
Based on $ARGUMENTS:
/branches - Show overview only
/branches cleanup - Interactive cleanup:
git branch -d <branch>
/branches cleanup-remote - Prune deleted remote branches:
git remote prune origin
git fetch --prune
/branches delete <name> - Delete specific branch:
git branch -d <name> # Safe delete (must be merged)
# or
git branch -D <name> # Force delete
.claude/hooks/play-tts.sh "Branch cleanup complete"
/branches - Show branch overview/branches cleanup - Clean merged branches/branches cleanup-remote - Prune remote tracking branches/branches delete feature/old-branch - Delete specific branch