clean-gone
Remove local Git branches whose upstreams are gone, including associated worktrees.
- License 许可
- MIT
- 所属仓库
- meymchen/skills
- 最近更新
- 2026-10-16
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- clean-gone
- description
- Remove local Git branches whose upstreams are gone, including associated worktrees.
02 资源文件 1
- 参考文档agents/openai.yaml270 B
03 SKILL.md 正文
Clean Gone Branches
Identify stale branches and their worktrees:
git fetch --prune origin
git branch -vv
git worktree list
For branches marked [gone], remove associated worktrees with
git worktree remove <path>, then delete the branch with git branch -d <branch>.
git branch -d refuses a squash-merged branch, because the squashed commit on the
base branch is not an ancestor of the branch tip. Do not treat that refusal as
unmerged work on its own — test whether the branch's tree already landed on the
base branch:
base=$(git rev-parse --abbrev-ref origin/HEAD) # falls back to origin/main
merge_base=$(git merge-base "$base" "$branch")
squashed=$(git commit-tree "$branch^{tree}" -p "$merge_base" -m _)
git cherry "$base" "$squashed"
A leading - means the base branch already contains an equivalent patch: the
branch was squash- or rebase-merged, so delete it with git branch -D <branch>
and count it as a normal removal without asking. A leading + means real
unmerged work: keep the branch and report it.
Preserve the current, default, protected, dirty, or locked branches, and any
branch the check marks +. Report what was removed, which removals needed -D
after a - result, and what Git refused to remove. Beyond the - case, use
force only when the user explicitly requests it for named targets.
04 同仓库更多 Skills
cleanup-merged-branch
Safely clean a merged local branch, reproducible worktree caches, and stale local branches before updating the repository default branch.
verify-acceptance-items
Verify a GitHub pull request or GitLab merge request (MR) against the acceptance criteria (验收标准/条件, task-list checkboxes) of the issues it links to, then tick the criteria it proves once the user confirms. Use when asked whether a PR or MR is done or meets its issue, when asked to check off an issue's checkboxes, or right after opening or updating a PR or MR that closes an issue.
update-request-body
Update the title and body of one or more GitHub pull requests or GitLab merge requests (MRs).
commit
Create a Git commit from the current changes.
commit-push-request
Commit current changes, push the branch, and open a GitHub pull request or GitLab merge request (MR).
testing-strategy
Design test strategies and test plans. Trigger with "how should we test", "test strategy for", "write tests for", "test plan", "what tests do we need", or when the user needs help with testing approaches, coverage, or test architecture.