https://github.com/coriolinus/git-clean
Clean up branches which have been merged or closed
https://github.com/coriolinus/git-clean
hacktoberfest
Last synced: 9 months ago
JSON representation
Clean up branches which have been merged or closed
- Host: GitHub
- URL: https://github.com/coriolinus/git-clean
- Owner: coriolinus
- Created: 2022-10-11T20:04:12.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-10-06T10:42:35.000Z (10 months ago)
- Last Synced: 2025-10-06T12:29:39.958Z (10 months ago)
- Topics: hacktoberfest
- Language: Rust
- Homepage:
- Size: 154 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `git-clean`
Clean your repo of excess branches which have been merged upstream.
There are five possible cases for a local branch:
1. It is the default branch (`main`/`master`)
2. Not pushed to the remote.
3. Pushed to the remote but 0 PRs created.
4. Pushed to the remote with at least 1 PR created, and at least 1 PR is not closed.
5. Pushed to the remote with at least 1 PR created, and all PRs are closed.
In cases 1 - 4, we retain the branch: it is assumed to still be in development or otherwise relevant.
However, in state 5, we delete the branch: it is no longer relevant.
## Installation
This project has no relation to the [`git-clean` on crates.io](https://crates.io/crates/git-clean).
Instead:
```bash
cargo install --git https://github.com/coriolinus/git-clean
```
## Authorization
In the event that you want to use this on a private repo, you will need to authenticate your requests with a token.
You need to create a classic token at with at least the permissions `repo` and `read:org`.
Provide the token with the `--personal-access-token TOKEN` option on the command line. This will cache the token for future use.