Skip to main content

TUI tool for managing and cleaning up git repositories

Project description

Git Cleaner — TUI for managing and cleaning up git repositories

Interactively browse, filter, and bulk-delete git branches from a fast terminal UI.

PyPI Python 3.11+ Textual 8.x MIT License


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/loginfeatureauthlogin)
🌐 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_cleaner_tui-1.8.0.tar.gz (82.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_cleaner_tui-1.8.0-py3-none-any.whl (34.3 kB view details)

Uploaded Python 3

File details

Details for the file git_cleaner_tui-1.8.0.tar.gz.

File metadata

  • Download URL: git_cleaner_tui-1.8.0.tar.gz
  • Upload date:
  • Size: 82.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for git_cleaner_tui-1.8.0.tar.gz
Algorithm Hash digest
SHA256 e2022e71a413f41ff7c7a50dfe5e099e2e692107fae82f9a2da7e2692ca393b8
MD5 3eca06d1e29f7f1a5cbdaab55ef85502
BLAKE2b-256 5eabaa2e9a59ffa918bdfd6dd981f05432a275580cfe94ee66de41154305bdf1

See more details on using hashes here.

File details

Details for the file git_cleaner_tui-1.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for git_cleaner_tui-1.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 753caad937c8fe8e5c70ef9a7dce4bbf498db2bb4224f5a459bb94d789880435
MD5 3eba2fa1871c7923e5ed2c5bc87f0c36
BLAKE2b-256 be05db15586d1d891b73d9e132cd13e983f193bd1dc9170830854608e21abf70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page