clean-branches
Use when local or remote git branches have accumulated after merges, when branches show as [gone] or stale, or when the branch list needs pruning.
от uw-ssec★ 33 звезды на GitHub
Установить clean-branches в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Clean Branches
Clean up local and remote git branches.
Arguments
Optional: all, stale, merged, or a specific branch name. If omitted,
prompt the user.
Instructions
Run these commands in parallel to gather branch information:
git branch(local branches)git branch -r(remote branches, exclude HEAD)git branch --merged main(branches merged into main)git for-each-ref --sort=-committerdate --format='%(refname:short) %(committerdate:relative) %(upstream:track)' refs/heads/(local branches with age and tracking status)
Categorize each branch (excluding
main):Category Definition Merged Branch is in git branch --merged mainoutputStale Last commit is older than 30 days Orphaned remote Remote branch exists but no local branch tracks it Orphaned local Local branch exists but remote is gone ( [gone]tracking status)Active Has recent commits and is not merged If no argument was given or it is unclear:
- Display a summary table of all branches grouped by category with branch name, last commit age, and local/remote status
- Ask the user which categories to clean: merged, stale, orphaned, or all
- Wait for the user's response before proceeding
If the argument specifies a category or "all":
- Show the list of branches that will be deleted
- Ask for confirmation before proceeding
Delete branches:
- Local branches:
git branch -d <name>(safe delete, merged only) orgit branch -D <name>(if user confirms force delete for unmerged) - Remote branches:
git push origin --delete <name> - Run
git fetch --pruneafter remote deletions
- Local branches:
Confirm results: show what was deleted and what remains.
Rules
- NEVER delete
mainormaster - NEVER force-delete (
-D) without explicit user confirmation - Always show what will be deleted before doing it
- If a branch has unmerged commits, warn the user and ask before force-deleting
- Run
git fetch --pruneat the end to clean up stale remote refs - If there are no branches to clean, say so and exit
Note on squash-merged branches
GitHub's squash merge rewrites commits, so a squash-merged branch will NOT
appear in git branch --merged main and git branch -d will refuse it. Before
force-deleting, confirm the work actually landed — check that the PR shows as
merged (gh pr list --state merged) and that git diff main..<branch> holds no
unique work.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл clean-branches?
Use when local or remote git branches have accumulated after merges, when branches show as [gone] or stale, or when the branch list needs pruning.
Как установить скилл clean-branches?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл clean-branches запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…