CLI command to clean up after a merged PR
- Dominant language
- Go
- Stars
- 46.3k
- Forks
- 9k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 89
Description
### 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:
```bash
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
```bash
gh pr cleanup 123
```
ought to take care of deleting the various branches for me. Or even
```bash
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
Contributor guide
Assessment
This issue has not been assessed yet.