/oh:git-clean-branches --base <branch> --stale <days> --remote --dry-run --yes --forcefrom oh
Use when repository has dozens of stale or merged branches cluttering the namespace, or when onboarding onto a project with an overwhelming branch list.
Ships in oh. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
安全识别并清理已合并或过期的 Git 分支。
💡 建议: 执行本命令前,建议先运行
/clear命令清理上下文,以获得更好的分析效果。
| 选项 | 说明 |
|---|---|
--base <branch> | 指定清理的基准分支(默认为 main/master) |
--stale <days> | 清理超过指定天数未提交的分支(默认不启用) |
--remote | 同时清理远程已合并/过期的分支 |
--dry-run | 默认行为。仅列出将要删除的分支,不执行任何操作 |
--yes | 跳过逐一确认,直接删除所有已识别的分支(适合 CI/CD) |
--force | 使用 -D 强制删除本地分支(即使未合并) |
git fetch --all --prune,确保分支状态最新--base 参数或自动识别的 main/master--base 的本地(及远程)分支--stale <days>,找出最后一次提交在 N 天前的分支--yes 参数,命令到此结束,等待用户确认仅在不带 --dry-run 且用户确认后(或带 --yes)执行:
git branch -d <branch>git push origin --delete <branch>--force,本地删除改用 git branch -D <branch>为防止误删重要分支,在仓库的 Git 配置中添加保护规则:
# 保护 develop 分支
git config --add branch.cleanup.protected develop
# 保护所有 release/ 开头的分支 (通配符)
git config --add branch.cleanup.protected 'release/*'
# 查看所有已配置的保护分支
git config --get-all branch.cleanup.protected
# [最安全] 预览将要清理的分支,不执行任何删除
git fetch --all --prune
git branch --merged main
# 清理已合并到 main 且超过 90 天未动的本地分支
# 先识别过期分支
git for-each-ref --sort=-committerdate --format='%(refname:short) %(committerdate:relative)' refs/heads/
# 清理已合并到 release/v2.1 的本地与远程分支
git branch --merged release/v2.1
git push origin --delete <branch>
# 强制删除一个未合并的本地分支
git branch -D outdated-feature
--dry-run:养成先预览再执行的习惯--base:维护长期 release 分支时,用它来清理已合并到该 release
的分支--force:除非百分百确定某个未合并分支是无用的release / develop 工作流What SKILL.md sets; muted values are Claude Code's defaults
haikunpx claudepluginhub zwmmm/oh-my-claudecode --plugin oh5 skills in this plugin
/git-commitUse when preparing to commit changes and wanting structured, consistent commit messages following Conventional Commits specification./git-rollbackUse when needing to revert a branch to a previous state, undo mistaken commits, or roll back emergency hotfixes to a known-good version./uniapp-uiUniApp + UnoCSS + WotUI page generator from designs. Converts screenshots or HTML/CSS to UniApp pages. Features: intelligent component mapping with priority (custom components, then WotUI, then built-in), 6 page templates (form, list, detail, tab, search, grid), auto-analyze custom components, cross-platform compatibility checks. Use for: creating UniApp pages, converting designs to code, mobile app/mini-program/H5 development. Actions: generate, create, build, convert, analyze, design. Tech: Vue3, UnoCSS, Wot Design Uni, UniApp.Other plugins' skills for the same job