cli / cli/cli

CLI command to clean up after a merged PR

未关闭
#380 24 条评论 82 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

core enhancement gh-pr pitch
主要语言
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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从提议的入口点 gh pr cleanup 123gh pr cleanup --all 开始,然后检查 issue 中展示的 Git 操作:更新基分支、删除本地分支和 fork 分支,以及检查 squash 或 rebase 后的更改。完成的标准是:无需检出基分支或删除未合并的工作,即可清理已合并的 PR 分支。

由索引模型根据 Issue 内容生成。

评估

技术栈
git, github, go
领域
cli, developer-experience
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。