CLI command to clean up after a merged PR
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 46.3k
- 派生
- 9.1k
- 平均合并
- 2 天 6 小时
- 30 天内合并 PR
- 97
描述
Describe the feature or problem you’d like to solve
After a PR of mine has been merged I currently have to
- click the button in the GUI to delete the branch (typically from a fork)
- navigate to my local clone
- run:
git checkout master # if not already on base branch
git pull
git branch -d local-branch
This is a bunch of manual steps which I need to repeat several times on a good day.
Proposed solution
Navigate to the local clone and
gh pr cleanup 123
ought to take care of deleting the various branches for me. Or even
gh pr cleanup --all
to clean up branches from any of my PRs which were merged since I last ran this.
Ideally this would fast-forward my local base branch reference without actually needing to check it out, in case I currently had checked out some other (unmerged) branch or had local modifications.
For bonus points, if some rude maintainer used squash or rebase, verify that the base branch really contains all the changes in my local branch before deleting it. Otherwise I need to check this manually if I am being careful. (Genuine merges behave better: if for example I forgot to push some last-minute commits, git branch -d will warn me that the branch is not actually merged. This warning is useless for squashed or rebased PRs because it is always printed.)
Additional context
N/A
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从提议的入口点 gh pr cleanup 123 和 gh pr cleanup --all 开始,然后检查 issue 中展示的 Git 操作:更新基分支、删除本地分支和 fork 分支,以及检查 squash 或 rebase 后的更改。完成的标准是:无需检出基分支或删除未合并的工作,即可清理已合并的 PR 分支。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- git, github, go
- 领域
- cli, developer-experience
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100