Clean up merged branches locally and on remote, keeping only main, dev, and gh-pages.
69
87%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Clean up stale branches that have been merged or are no longer needed.
main, dev, gh-pages):git branch | grep -v -E '^\*|main$|dev$|gh-pages$'Report what will be deleted. If no branches found, say "No local branches to clean" and skip to step 3.
git branch -d <branch-name>If a branch is not fully merged, report it to the user and ask whether to force-delete. Do NOT force-delete without confirmation.
main, dev, gh-pages, HEAD):git branch -r | grep -v -E 'origin/main$|origin/dev$|origin/gh-pages$|origin/HEAD'Report what will be deleted. If no branches found, say "No remote branches to clean" and skip to step 5.
git push origin --delete <branch-names>git remote prune origingit branch # local
git branch -r # remotePresent a summary:
| Item | Count |
|---|---|
| Local branches deleted | N |
| Remote branches deleted | N |
| Remaining local | main, dev |
| Remaining remote | origin/main, origin/dev, origin/gh-pages |