pr-to-main-cleanup

仓库创建 2025年11月2日最近提交 17 小时前SkillHot 收录 20 天前
▸ 精选理由

适合常有遗留已合并分支需批量清理的仓库维护流程。

▸ 风险提示

会执行删除分支的 git 操作,可能导致误删历史分支需谨慎。

这个 Skill 做什么

在 PR 合并后删除已合并的功能分支,执行本地与远程的清理操作。

把已合并到 main 的功能分支在本地和远程都清理掉,过程包括切回 main、拉最新、删除本地分支和删除远端分支。常在 PR 合并后做收尾,防止分支堆积、仓库混乱。会按步骤执行必要的 git 命令,尽量做到安全稳妥的清理。

▸ 展开 SKILL.md 英文原文

Clean up merged feature branches after PR to main is merged. Use when the user says "ブランチ削除", "cleanup", "マージ後の片付け", or wants to delete a merged branch.

开发编程git分支管理清理通用
5.3k
Stars
571
Forks
12
仓库内 Skill
+26
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/breaking-brake/cc-wf-studio/main/.claude/skills/pr-to-main-cleanup/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/breaking-brake/cc-wf-studio/main/.claude/skills/pr-to-main-cleanup/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# PR to Main Cleanup

Delete merged feature branches after PR is merged to main.

## Workflow

1. **Gather context** (parallel):
   - `git branch` to identify current branch
   - `git log --oneline -1` to confirm current state

2. **Execute cleanup**:
   - Switch to main branch
   - Pull latest changes from origin
   - Delete local feature branch
   - Delete remote feature branch

## Commands

```bash
git checkout main && git pull origin main && git branch -D <branch-name> && git push origin --delete <branch-name>
```

## Important Notes

- PRs to main are always squash-merged, so use `-D` (force delete) since git cannot detect squash merges as "merged"
- Always pull latest main before delet
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有