Skip to main content

TUI tool for browsing and bulk-deleting git branches

Project description

Git Cleaner

TUI tool for interactively browsing and bulk-deleting git branches, with repo maintenance (GC, repack, prune), a stash browser, and multi-repo bookmarks.

Python Textual License

Built with Textual + Python 3.11+.


Installation

uv tool install git-cleaner-tui
git-cleaner-tui

Or from source:

git clone https://github.com/Allentgt/Git-Cleaner
cd git-cleaner
uv sync
uv run git-cleaner-tui --repo /path/to/repo

Requires Python ≥ 3.11, uv (or pip), and a git repository.


Features

  • 🗓️ Date filtering — Pick From/Until dates (calendar picker) or use presets: 7d, 30d, 90d, 1y
  • 🔍 Branch browser — Tree view with prefix grouping (feature/, bugfix/, …), ahead/behind tracking, stale badge (>180d), details pane on select
  • 🛡️ Protectionmain/master/develop + custom patterns from .git-branch-cleaner.toml; cannot be selected
  • ⛔ Blacklist — Wildcard patterns (archive/*); hidden by default
  • ☁️ Remote deletion — Toggle r to also delete on remote (git push origin --delete)
  • 🧪 Dry Run — Toggle to preview deletions without executing
  • ↩️ Undo — Press u to restore the last batch via reflog (git branch <name> <hash>)
  • 📥 CSV/JSON export — Download filtered branch list to CWD
  • 🔧 Maintenance dashboard — Repo health stats + GC/Repack/Prune/Reflog tasks
  • 📦 Stash browser — List/drop/apply/pop stashes from the Stashes tab
  • 🔖 Multi-repo bookmarksCtrl+B to save and switch between repos
  • ⚡ Fast — Single git for-each-ref call; bulk delete with one confirm

Usage

git-cleaner-tui
# or: git-cleaner-tui --repo /path/to/repo

Branches Tab

Key Action
Space Toggle selection
a Select / deselect all
d Delete selected (with confirmation)
r Toggle remote deletion
p Toggle protected visibility
b Toggle blacklisted visibility
u Undo last deletion batch
Ctrl+R Refresh
Ctrl+B Open bookmarks

Date presets (7d/30d/90d/1y) sit next to the Load button. Branches appear grouped by prefix in a collapsible Tree. Select a leaf node to see its last-commit details.

Maintenance Tab

Health stats and one‑click tasks: Git GC, GC Aggressive, Repack, Prune Remote, Expire Reflog, or Run All (sequential). Runs async — UI stays responsive.

Stashes Tab

DataTable of all stashes with Drop / Apply / Pop / Refresh buttons.

Bookmarks

Ctrl+B opens a modal to add the current repo, remove it, or switch to a bookmarked repo. Persisted in ~/.git-branch-cleaner.toml.


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.


Keybindings

Tab Key Action
Branches Space Toggle selection
Branches a Select / deselect all
Branches d Delete selected
Branches r Toggle remote
Branches p Toggle protected
Branches b Toggle blacklisted
Branches u Undo deletion
Branches Ctrl+R Reload
All Ctrl+B Bookmarks

Development

git clone https://github.com/Allentgt/Git-Cleaner
cd git-cleaner
uv sync --dev
uv run pytest        # 23 tests
uv run git-cleaner-tui

FAQ

Q: Can I undo a deletion?
Yes — press u immediately after deleting. Undo uses git branch <name> <hash> via the stored commit hash.

Q: Does it work on Windows?
Yes. Tested on Windows, macOS, Linux. Python 3.11+.

Q: How are dates filtered?
By the commit date of the branch tip. Both From and Until are inclusive.

Q: 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.3.0.tar.gz (5.3 MB 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.3.0-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_cleaner_tui-1.3.0.tar.gz
  • Upload date:
  • Size: 5.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for git_cleaner_tui-1.3.0.tar.gz
Algorithm Hash digest
SHA256 3926d987083b3266ba33e82804358f059c6f1ca4351581af6a9988721daa5e10
MD5 fc72eb73beca738a726a34c4cb24147e
BLAKE2b-256 37e097b68ff18b79d103040da96e9063390f0d9cf138179502eb0f8c2fee64dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_cleaner_tui-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for git_cleaner_tui-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c97af4fd1fb3e237667d795e2e5dbdacbcec0f371d443e24da424a4fa4dc0f2d
MD5 ceb11cb17f3f99d4771b7714a14929a4
BLAKE2b-256 fba4fe75a6de5d07dab809835777be0b66c96652419b5fa72c941e3f941828e9

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