An interactive CLI tool for managing Git worktrees with a beautiful Rich-based interface. Simplify worktree creation, management, and visualization with guided workflows and comprehensive status information.
- 🎯 Interactive Worktree Creation: Guided workflow for creating new worktrees with branch selection
- 📊 Comprehensive Status Display: View all worktrees with branch info, commit details, and change status
- 🔍 Diff Summaries: See what changes exist between worktree branches and their base branches
- ⚙️ Configurable Storage: Set custom locations for worktree storage with persistent preferences
- 🎨 Rich UI: Beautiful terminal interface with colors, tables, and progress indicators
- ⚡ Performance Optimized: Efficient Git operations with caching for large repositories
- 🛠️ Developer Friendly: Easy setup with Makefile and shell alias support
# Clone and install
git clone https://github.com/JoshYG-TheKey/git-worktree-manager.git
cd git-worktree-manager
make install-dev && make setup-alias
# Use the tool (with convenient alias)
gitwm
- Python: 3.8 or higher
- Git: 2.15 or higher (for worktree support)
- Terminal: Must support Rich formatting (most modern terminals)
- Context: Must be run from within a Git repository
git clone https://github.com/JoshYG-TheKey/git-worktree-manager.git
cd git-worktree-manager
make install-dev # Install with dev dependencies
make setup-alias # Create 'gitwm' alias
pip install git-worktree-manager
git clone https://github.com/JoshYG-TheKey/git-worktree-manager.git
cd git-worktree-manager
pip install -e .
The Makefile can automatically set up a convenient gitwm
alias:
make setup-alias # Adds alias to ~/.zshrc and ~/.bashrc
source ~/.zshrc # Reload shell (or restart terminal)
gitwm --help # Test the alias
To remove the alias later:
make remove-alias
# Using the full command
git-worktree-manager
# Using the alias (after setup)
gitwm
The tool presents an interactive menu with options:
- 📁 Create new worktree - Guided worktree creation
- 📋 List worktrees - View all existing worktrees
- ⚙️ Configure - Set preferences and default paths
- ❌ Exit - Quit the application
gitwm --help # Show help
gitwm --version # Show version
gitwm --config-path # Show config file location
$ gitwm
┌─ Git Worktree Manager ─┐
│ 1. Create new worktree │
│ 2. List worktrees │
│ 3. Configure │
│ 4. Exit │
└─────────────────────────┘
# Select option 1
Enter worktree name: feature-auth
Select base branch: main
Storage location: /Users/dev/worktrees ✓
✅ Created worktree 'feature-auth' at /Users/dev/worktrees/feature-auth
$ gitwm
# Select option 2 - List worktrees
┌─ Active Worktrees ─────────────────────────────────────────┐
│ Name │ Branch │ Status │ Changes │ Path │
├──────────────┼──────────────┼───────────┼─────────┼────────┤
│ main │ main │ Clean │ 0 │ ~/repo │
│ feature-auth │ feature-auth │ Modified │ 3 │ ~/wt/… │
│ bugfix-123 │ bugfix-123 │ Clean │ 0 │ ~/wt/… │
└──────────────┴──────────────┴───────────┴─────────┴────────┘
📊 Diff Summary for feature-auth:
• 2 files modified
• 1 file added
• 0 files deleted
• +45 insertions, -12 deletions
$ gitwm
# Select option 3 - Configure
Current Settings:
Default Path: ~/worktrees
Theme: dark
Show Progress: true
What would you like to configure?
1. Change default worktree path
2. UI preferences
3. Reset to defaults
# Select option 1
Enter new default path: ~/projects/worktrees
✅ Configuration saved
# Set default worktree storage location
export WORKTREE_DEFAULT_PATH="~/my-worktrees"
# Enable debug mode
export WORKTREE_DEBUG=1
# Custom config file location
export WORKTREE_CONFIG_PATH="~/.config/my-worktree-config.toml"
Location: ~/.config/git-worktree-manager/config.toml
[worktree]
default_path = "~/worktrees"
auto_cleanup = true
[ui]
theme = "dark"
show_progress = true
max_display_items = 50
[performance]
cache_timeout = 300
max_cached_items = 100
Section | Option | Default | Description |
---|---|---|---|
worktree |
default_path |
~/worktrees |
Default storage location |
worktree |
auto_cleanup |
true |
Auto-remove stale worktrees |
ui |
theme |
dark |
UI color theme |
ui |
show_progress |
true |
Show progress indicators |
performance |
cache_timeout |
300 |
Cache timeout in seconds |
# Full development setup
make install-dev # Install with dev dependencies
make setup-alias # Create shell alias
make test # Run tests
make lint # Check code quality
make help # Show all available commands
make install # Install package
make install-dev # Install with dev dependencies
make test # Run tests
make test-coverage # Run tests with coverage
make lint # Run linting
make format # Format code
make clean # Clean build artifacts
make setup-alias # Create 'gitwm' shell alias
make remove-alias # Remove shell alias
make test # Run all tests
make test-coverage # Run with coverage report
pytest tests/test_git_ops.py -v # Run specific test file
# Ensure you're in a Git repository
git status
# If not, initialize or navigate to a Git repo
git init # or cd /path/to/git/repo
# Check Git version (requires 2.15+)
git --version
# Check Git worktree support
git worktree --help
# Check directory permissions
ls -la ~/worktrees
# Create directory with proper permissions
mkdir -p ~/worktrees
chmod 755 ~/worktrees
# Test Rich compatibility
python -c "from rich.console import Console; Console().print('Test')"
# Use basic mode if needed
export TERM=xterm-256color
Enable verbose logging:
export WORKTREE_DEBUG=1
gitwm
For large repositories:
# Increase cache timeout
export WORKTREE_CACHE_TIMEOUT=600
# Limit displayed items
export WORKTREE_MAX_DISPLAY=25
- 📖 Documentation: See CONTRIBUTING.md for development
- 🐛 Bug Reports: Open GitHub issues
- 💬 Questions: Use GitHub discussions
- 🔧 Development: Check the Makefile for common tasks
- Feature Development: Create isolated environments for each feature
- Bug Fixes: Quickly switch between main and bugfix branches
- Code Review: Check out PR branches without affecting main work
- Experimentation: Try different approaches in separate worktrees
- Parallel Development: Work on multiple features simultaneously
- Testing: Maintain separate worktrees for different test scenarios
- Release Management: Keep release branches in dedicated worktrees
- Code Archaeology: Explore different versions without branch switching
Optimized for large repositories:
- ⚡ Fast Operations: Complete within 2 seconds for up to 100 worktrees
- 🧠 Smart Caching: Branch lists and commit information cached
- 📊 Efficient Git Commands: Uses
--porcelain
flags for consistent parsing - 🔄 Progressive Loading: Large datasets loaded incrementally
- 💾 Memory Efficient: Streams large command outputs
We welcome contributions! See CONTRIBUTING.md for detailed guidelines.
Quick contribution setup:
git clone https://github.com/JoshYG-TheKey/git-worktree-manager.git
cd git-worktree-manager
make install-dev
make test
# Make your changes
make format && make lint && make test
MIT License - see LICENSE file for details.
- Built with Rich for beautiful terminal UI
- Uses Click for CLI framework
- Inspired by Git's powerful worktree functionality
Made with ❤️ for developers who love Git worktrees