CLI tool to analyze and clean up stale, merged, and orphaned Git branches
Project description
GitClean
A CLI tool that analyzes Git repositories for stale, merged, and orphaned branches, then helps you clean them up interactively.
Install
pip install branchclean
Usage
Scan branches
# Scan current repo
gitclean scan
# Custom staleness threshold
gitclean scan --stale-days 30
# JSON output
gitclean scan --json
# Scan all repos in a directory
gitclean scan --dir ~/projects --multi
Clean branches
# Interactive cleanup
gitclean clean
# Preview what would be deleted
gitclean clean --dry-run
# Skip prompts (use with caution)
gitclean clean --force
Configuration
Create a .gitcleanrc file in your repo root or home directory:
{
"trunk": "main",
"stale_days": 60,
"protected_patterns": ["release/*", "hotfix/*"],
"include_remote": true
}
View resolved config:
gitclean config
Branch Categories
| Category | Meaning | Color |
|---|---|---|
| merged | Already merged into trunk | Green |
| orphaned | Upstream tracking branch is gone | Yellow |
| stale | No commits in N days (default: 90) | Red |
| active | Everything else | Dim |
Requirements
- Python 3.10+
- Git
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
branchclean-0.1.0.tar.gz
(9.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file branchclean-0.1.0.tar.gz.
File metadata
- Download URL: branchclean-0.1.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e98107e3dadd8597a281f4b534fa73d8850e07225ac4542fe98811806ae7bc1
|
|
| MD5 |
0685fa99de337126a54b8536ec6a440d
|
|
| BLAKE2b-256 |
7aa53022c49ef2e91a52567e6ca13417be331707e8bc71b4a51c3837e614cd9c
|
File details
Details for the file branchclean-0.1.0-py3-none-any.whl.
File metadata
- Download URL: branchclean-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b8e2644859bc9e9e908b9864e1cb40da172e57cb92000c1922bb5c175f95ebc
|
|
| MD5 |
f92d310383f5f20a4df9b229f940b289
|
|
| BLAKE2b-256 |
ba3e9e180068c90b1e8518484d9d0ff60af6f7d14204a632081b7476eeff4861
|