https://github.com/seachicken/gh-poi
✨ Safely clean up your local branches
https://github.com/seachicken/gh-poi
cli gh-extension
Last synced: 2 months ago
JSON representation
✨ Safely clean up your local branches
- Host: GitHub
- URL: https://github.com/seachicken/gh-poi
- Owner: seachicken
- License: mit
- Created: 2021-09-30T19:59:12.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2026-03-29T11:29:10.000Z (3 months ago)
- Last Synced: 2026-04-02T08:39:48.333Z (3 months ago)
- Topics: cli, gh-extension
- Language: Go
- Homepage: https://dev.to/seachicken/safely-clean-up-your-local-branches-9i3
- Size: 242 KB
- Stars: 931
- Watchers: 4
- Forks: 33
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-gh-extensions - seachicken/gh-poi - 01-18 | ✨ Safely clean up your local branches | (⭐ Most Starred)
- awesome-gh-cli-extensions - **poi** - Safely clean up your local branches. (Git)
- jimsghstars - seachicken/gh-poi - ✨ Safely clean up your local branches (Go)
- gh-extension-atlas - gh-poi - poi` | Safe branch cleanup | Removes merged branches without reckless deletion. | active | (Repo & Branch)
README
# gh poi

A GitHub CLI extension to safely clean up local branches you no longer need.
## Motivation
Daily development makes it difficult to know which branch is active when there are many unnecessary branches left locally, which causes a small amount of stress. If you squash merge a pull request, there is no history of the merge to the default branch, so you have to force delete the branch to clean it up, and you have to be careful not to accidentally delete the active branch.
We have made it possible to automatically determine which branches have been merged and clean up the local environment without worry.
## Installation
```
gh extension install seachicken/gh-poi
```
## Usage
- `gh poi` Delete the merged local branches
- `gh poi --state (closed|merged)` Specify the PR state to delete (default `merged`)
- `gh poi --scan (quick|deep)` Specify the scan mode (default `quick`)
- `quick`: Fast; checks "origin" and "upstream" remotes. Identifies PRs using only the latest commit on each branch
- `deep`: Comprehensive; scans all registered remotes. Performs a deeper history check to link branches to PRs, ensuring no potential matches are missed across multiple forks
- Note: poi ensures safe deletion in both modes
- `gh poi --dry-run` Show branches to delete without actually deleting it
- `gh poi --debug` Enable debug logs
- `gh poi lock ...` Lock branches to prevent them from being deleted
- `gh poi unlock ...` Unlock branches to allow them to be deleted

## FAQ
### Why the name "poi"?
"poi" means "feel free to throw it away" in Japanese.
If you prefer an alias, you can change it with [gh alias set](https://cli.github.com/manual/gh_alias_set). (e.g. `gh alias set clean-branches poi`)