269
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill gotalab/skillport --skill git-branch-cleanup- SKILL.md7.7 KB
Overview
This skill analyzes and safely cleans up local Git branches by categorizing them by merge status, staleness, remote tracking, and worktree association. It provides interactive selection, dry-run previews, and safety guards to prevent accidental deletion of important branches. Use it to safely remove merged or abandoned branches and keep your repository tidy.
How this skill works
The skill collects branch metadata (last commit date, upstream tracking, merged/unmerged status, worktree presence, and ahead/behind info) and classifies branches into categories like Merged (safe), Gone Remote, Stale, Ahead of Upstream, Has Worktree, and Unmerged. It then displays results, prompts the user to choose categories or individual branches to delete, verifies safety rules (protected names, current branch, unpushed commits, worktrees), and executes deletion after confirmation or a dry run when requested.
When to use it
- Cleaning up local branches after feature merge cycles
- Removing branches whose remote was deleted
- Identifying and reviewing stale branches (default 30+ days)
- Previewing deletions before running destructive commands (--dry-run)
- Maintaining a clean local repo before onboarding or CI runs
Best practices
- Always run a dry run first to preview deletions
- Respect protected branch names (main, master, develop, trunk) and current branch
- Do not delete branches that are ahead of upstream without reviewing unpushed commits
- Remove or detach worktrees before deleting associated branches
- Adjust stale threshold to your team cadence (e.g., 14 days for 2-week sprints)
Example use cases
- Bulk-delete merged branches while excluding protected and current branches
- Prune branches whose remotes were removed and clean up their worktrees
- List oldest branches to find candidates for archival or deletion
- Run interactive selection to delete only merged + remote-deleted categories
- Use dry-run mode to generate a safe deletion list for team review
FAQ
Dry run lists branches that would be deleted without running git branch -d/-D. Use flags like --dry-run, preview, or ask to just show results.
What branches are never deleted automatically?
Protected names (main, master, trunk, develop, development) and the currently checked out branch are always excluded. Branches ahead of upstream are also blocked until reviewed.