git-prune-branches-local
Installation
SKILL.md
Git Prune Branches (Local)
Check and prune local branches that have been merged:
- Get the list of all local branches using
git branch - For each branch, check if it has been merged into the main branch using
git branch --merged - Exclude protected branches (main, master, develop, etc.)
- Create a list of branches that are safe to delete
- Present the deletion list to the user clearly
- Ask for confirmation: "The following local branches will be deleted. Proceed? (yes/no)"
- If user confirms with "yes" or similar affirmative response, delete the branches using
git branch -d <branch-name>for each branch - Report the results
Important: Never delete:
- The currently checked out branch
- Protected branches: main, master, develop, development, staging, production
- Branches that are not fully merged (unless explicitly requested)