deadbranch is a tool that helps users identify and remove old, unused git branches, reducing clutter in their repositories. It prioritizes safety by protecting crucial branches and necessitates explicit confirmation for deletions, ensuring that important work is never lost.
deadbranch is a command-line tool designed to streamline the management of stale git branches in repositories. By identifying and safely removing unused branches, it helps keep the repository organized and efficient. This tool prioritizes safety, as it only deletes branches that have been merged and protects critical branches such as main, master, develop, staging, and production by default. Here are some key features:
Key Features
- List Stale Branches: Effortlessly identify branches that are older than a specified number of days (default is 30 days).
- Safe Deletion: Automatically removes only merged branches to prevent accidental data loss.
- Protected Branches: Excludes essential branches from deletion, ensuring critical parts of the development process are never affected.
- WIP Detection: Automatically detects and excludes work-in-progress branches and draft branches to keep the focus on completed work.
- Backup Creation: Each deletion creates a backup of deleted branch SHAs, allowing for easy restoration if needed.
- Dry Run Mode: Preview potential deletions without making actual changes, providing an opportunity to review before confirming actions.
- Interactive TUI: An intuitive text user interface that supports fuzzy search, visual selection, and familiar navigation for easy branch management.
Use Cases
- Quick Start: Users can quickly list outdated branches, delete stale merges, and maintain an overview of branch health.
Example Command Usage:
# List all stale branches
deadbranch list
# Delete merged stale branches after confirmation
deadbranch clean
# Preview branch deletions without actual deletion
deadbranch clean --dry-run
# Manage branches interactively in a TUI
deadbranch clean -i
Interactive Features
The interactive mode provides users with a full-screen view for browsing, filtering, and selecting branches for deletion, complete with Vim-style navigation and visual selection options. This approach enables granular control over what branches to delete while ensuring that essential branches remain untouched.
Safety and Configuration
deadbranch incorporates robust safety mechanisms to prevent accidental deletions, such as confirmation prompts and backup functionality. Users can customize their configuration via a config.toml file, setting default parameters like branch age thresholds and protected branches.
In summary, deadbranch enhances repository management by ensuring it stays clutter-free and that important branches remain protected while providing tools to restore any accidentally deleted branches.
No comments yet.
Sign in to be the first to comment.