Interactively browse, filter, and bulk-delete git branches from a fast terminal UI.
Install
uv tool install git-cleaner-tui
git-cleaner
Or from source:
git clone https://github.com/Allentgt/Git-Cleaner
cd git-cleaner
uv sync
uv run git-cleaner --repo /path/to/repo
Requires Python ≥ 3.11, uv (or pip), and a git repository.
Optional: pip install git-filter-repo for history rewriting features (delete files from history, drop commits).
Features
Branches tab
| Feature | Details | |
|---|---|---|
| 🌳 | Tree view | Branches grouped by prefix (feature/auth/login → feature → auth → login) |
| 🌐 | Local / Remote / All | Press r to cycle scope; All mode shows branches under Local (N) and Remote (N) headings |
| 📅 | Date filtering | Calendar picker or presets: 7d, 30d, 90d, 1y |
| 🛡️ | Protection | main/master/develop + custom patterns; cannot be selected |
| ⛔ | Blacklist | Wildcard patterns (archive/*); hidden by default |
| ☁️ | Remote deletion | Remote branches detected and pushed to git push origin --delete |
| 🧪 | Dry run | Preview deletions without executing |
| ↩️ | Undo | Press u to restore the last batch via reflog |
| 📥 | Export | Download filtered branch list as CSV or JSON |
Commits tab
| Feature | Details | |
|---|---|---|
| 📋 | Commit log | Load and browse commits for any branch |
| 🗑️ | Delete file from history | Press f to remove a file from every commit using git filter-repo |
| ✂️ | Drop commit | Press x to remove a commit and rewrite all subsequent commits |
| 🚀 | Force push | After rewrite, prompted to force-push to origin (creates backup branch first) |
Compare, Worktrees, Pull Requests, Stale
| Feature | Details | |
|---|---|---|
| 🔀 | Branch compare | Compare any two branches side by side |
| 🌲 | Worktrees | List, create, and remove git worktrees |
| 🔗 | Pull Requests | View open PRs/MRs from GitHub or GitLab |
| 🧊 | Stale detection | Identify branches with no recent activity |
Other
| Feature | Details | |
|---|---|---|
| 🔧 | Maintenance | GC, Repack, Prune, Reflog expiry — one click |
| 📦 | Stash browser | List, drop, apply, pop stashes |
| 🔖 | Bookmarks | Ctrl+B to save and switch between repos |
| ⚡ | Fast | Single git for-each-ref call; bulk delete with one confirm |
Keybindings
| Key | Action |
|---|---|
Space |
Toggle branch selection |
a |
Select / deselect all |
d |
Delete selected (with confirmation) |
r |
Cycle branch scope (Local → Remote → All) |
p |
Toggle protected visibility |
b |
Toggle blacklisted visibility |
u |
Undo last deletion batch |
U |
Undo all deletions |
H |
Undo history |
f |
Delete file from history (Commits tab) |
x |
Drop commit from history (Commits tab) |
Ctrl+R |
Refresh |
Ctrl+B |
Open bookmarks |
h / ? |
Help |
Configuration
~/.git-branch-cleaner.toml (global) or .git-branch-cleaner.toml (per-repo):
[protected]
patterns = ["release/*", "hotfix/*"]
[blacklist]
patterns = ["archive/*", "wip-*"]
[theme]
name = "textual-dark"
Hardcoded defaults (always active): main, master, develop. The checked-out branch is also protected.
Development
git clone https://github.com/Allentgt/Git-Cleaner
cd git-cleaner
uv sync --dev
uv run pytest
uv run git-cleaner-tui
FAQ
Can I undo a deletion?
Yes — press u immediately after deleting. Undo uses git branch <name> <hash> via the stored commit hash.
Does it work on Windows?
Yes. Tested on Windows, macOS, and Linux. Python 3.11+.
How are dates filtered?
By the commit date of the branch tip. Both From and Until are inclusive.
Does the maintenance dashboard modify my repo?
It runs real git commands that modify .git. They don't change working tree files.
License
MIT
Metadata
Release files for git-cleaner-tui 1.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| git_cleaner_tui-1.8.0.tar.gz | 82.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| git_cleaner_tui-1.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 116.5 kB
Release files / git_cleaner_tui-1.8.0.tar.gz
| Download URL | git_cleaner_tui-1.8.0.tar.gz |
|---|---|
| Size | 82.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e2022e71a413f41ff7c7a50dfe5e099e2e692107fae82f9a2da7e2692ca393b8
|
|
BLAKE2b-256 checksum How to use checksums |
5eabaa2e9a59ffa918bdfd6dd981f05432a275580cfe94ee66de41154305bdf1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / git_cleaner_tui-1.8.0-py3-none-any.whl
| Download URL | git_cleaner_tui-1.8.0-py3-none-any.whl |
|---|---|
| Size | 34.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
753caad937c8fe8e5c70ef9a7dce4bbf498db2bb4224f5a459bb94d789880435
|
|
BLAKE2b-256 checksum How to use checksums |
be05db15586d1d891b73d9e132cd13e983f193bd1dc9170830854608e21abf70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|