CLI tool integrating git worktree with Claude Code for seamless feature development workflows
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
Claude Worktree
Work on multiple git branches simultaneously with isolated AI coding sessions
What is this?
claude-worktree (command: cw) helps you work on multiple features at the same time by creating separate directories for each branch. No more switching branches, stashing changes, or losing context.
Each feature gets:
- ✅ Its own directory (git worktree)
- ✅ Its own AI coding session (Claude Code, Codex, or custom)
- ✅ Zero interference with other work
Perfect for developers who want to:
- Work on multiple features in parallel
- Keep AI conversation context for each feature
- Never lose work when switching tasks
- Cleanly merge features without conflicts
Why Use This?
No More Branch Switching Chaos
Before claude-worktree:
# Working on feature-api
git add .
git stash # Save current work
git checkout main
git checkout -b fix-urgent-bug
# Fix bug, commit
git checkout feature-api
git stash pop # Hope nothing conflicts
# Where was I?
With claude-worktree:
cw new fix-urgent-bug
# Fix bug in separate directory
cw merge fix-urgent-bug --push
# Return to feature-api - it's untouched
Each feature stays isolated, AI context is preserved, and switching is instant.
Lightning-Fast Workflow with Shell Completion
Tab completion makes everything faster:
cw <TAB> # All commands appear
cw new --<TAB> # All options for 'new' command
cw resume <TAB> # Your branch names
cw-cd <TAB> # Jump to any worktree instantly
No more typing long commands or remembering branch names - just type and press Tab.
Quick Start
Install
# Using uv (recommended)
uv tool install claude-worktree
# Or using pip
pip install claude-worktree
Basic Usage
# 1. Create a new feature worktree
cw new fix-login-bug
# This creates:
# - A new branch: fix-login-bug
# - A new directory: ../myproject-fix-login-bug/
# - Launches Claude Code in that directory
# 2. Work on your feature
# (AI helps you, you commit changes, etc.)
# 3. When done, create a PR
cw pr
# Or merge directly (for solo projects)
cw merge --push
That's it! You've just created an isolated workspace with AI assistance, worked on your feature, and merged it back.
Key Features
Essential Commands
| Command | What it does |
|---|---|
cw new <name> |
Create new feature worktree + launch AI |
cw new <name> --term i-t |
Create worktree, launch AI in iTerm tab |
cw list |
Show all your worktrees |
cw resume [branch] |
Resume AI session in a worktree |
cw pr |
Create GitHub pull request |
cw merge |
Merge to base branch and cleanup |
cw delete <name> |
Remove a worktree |
Shell Completion & Navigation
Enable tab completion for faster workflow:
# Install completion (bash/zsh/fish/PowerShell)
cw --install-completion
# Restart your shell, then enjoy:
cw <TAB> # Shows available commands
cw new --<TAB> # Shows available options
cw resume <TAB> # Shows branch names
Windows PowerShell users:
# Install completion for PowerShell
cw --install-completion powershell
# Restart PowerShell, then use tab completion:
cw <TAB> # Shows available commands
cw resume <TAB> # Shows branch names
Quick navigation between worktrees:
# Interactive setup (recommended):
cw shell-setup
# Or install manually:
# bash/zsh: Add to ~/.bashrc or ~/.zshrc
source <(cw _shell-function bash)
# fish: Add to ~/.config/fish/config.fish
cw _shell-function fish | source
# PowerShell: Add to $PROFILE
cw _shell-function powershell | Invoke-Expression
# Then use:
cw-cd feature-api # Jump to any worktree instantly
cw-cd <TAB> # Tab completion works!
Example Workflow
Scenario: Working on multiple features
# Start 3 features at once
cw new feature-api
cw new fix-bug-123
cw new refactor-db
# Check what you have
cw list
# BRANCH STATUS PATH
# main clean .
# feature-api active ../myproject-feature-api
# fix-bug-123 modified ../myproject-fix-bug-123
# refactor-db clean ../myproject-refactor-db
# Resume work on a specific feature
cw resume fix-bug-123
# Complete features as they're done
cw pr feature-api # Create PR
cw merge fix-bug-123 --push # Direct merge
Scenario: Team collaboration
# Create feature and share
cw new team-feature
git push -u origin team-feature
# Stay in sync with team
cw sync team-feature
# Compare before merging
cw diff main team-feature --summary
# Create PR for review
cw pr --title "Add awesome feature"
Configuration
AI Tool Selection
By default, cw launches Claude Code. You can easily change this:
# Use a preset
cw config use-preset claude # Claude Code (default)
cw config use-preset claude-remote # Remote control (phone/tablet)
cw config use-preset codex # OpenAI Codex
cw config use-preset no-op # Skip AI launch
# Or set custom tool
cw config set ai-tool "your-ai-tool"
# List available presets
cw config list-presets
Auto-Copy Files
Automatically copy project-specific files (like .env) to new worktrees:
# Add files to copy list
cw config copy-files add .env
cw config copy-files add .env.local
cw config copy-files add config/local.json
# List configured files
cw config copy-files list
# Remove a file from the list
cw config copy-files remove .env
Note: Dependencies like node_modules and .venv are automatically symlinked (not copied) to save disk space.
For detailed configuration options (remote control, auto-updates, export/import, etc.), see Configuration Guide.
More Features
Maintenance & Cleanup: cw clean, cw sync, cw doctor
Analysis: cw tree, cw stats, cw diff
Backup & Restore: cw backup create/restore
Stash Management: cw stash save/apply
See Advanced Features Guide for details.
Command Reference
For the complete command reference with all options, see Commands Documentation or run:
cw --help
cw <command> --help
Requirements
- Git: 2.31+ (for worktree support)
- Python: 3.11+
- AI Tool (optional): Claude Code, Codex, or custom
Installation Methods
Using uv (recommended)
uv tool install claude-worktree
Using pip
pip install claude-worktree
From source
git clone https://github.com/DaveDev42/claude-worktree.git
cd claude-worktree
uv pip install -e .
Troubleshooting
"Not a git repository"
Run commands from within a git repository.
"AI tool not detected"
Install your AI tool or skip AI launch:
cw config use-preset no-op
"Rebase failed"
Resolve conflicts manually:
cd <worktree-path>
git rebase <base-branch>
# Fix conflicts
git rebase --continue
cw pr # or cw merge --push
Shell completion not working
cw --install-completion
# Restart shell
For more troubleshooting help, see TROUBLESHOOTING.md.
Documentation
User Guides
- Commands Reference - Complete command reference with all options
- Configuration Guide - AI tools, presets, shell completion, export/import
- Advanced Features - Backup/restore, sync, cleanup, CI/CD
- Troubleshooting - Common issues and solutions
Links
- GitHub Issues - Report bugs or request features
- PyPI - Package page
- Changelog - Release history
Contributing
Contributions welcome! For development setup:
git clone https://github.com/DaveDev42/claude-worktree.git
cd claude-worktree
uv pip install -e ".[dev]"
# Run tests
uv run --extra dev pytest
# Run linting
ruff check src/ tests/
mypy src/claude_worktree
For maintainers: Use the automated release script to create new releases:
# Create a patch release (0.10.20 → 0.10.21)
uv run python scripts/release.py
# Create a minor release (0.10.20 → 0.11.0)
uv run python scripts/release.py --minor
# Create a major release (0.11.0 → 1.0.0)
uv run python scripts/release.py --major
CHANGELOG management: The changelog is automatically generated from GitHub Releases. When a release PR is merged:
- GitHub automatically creates a Release with notes (PR-based)
- Workflow updates
CHANGELOG.mdfrom Releases - Changes are committed to main
To manually update the changelog:
python scripts/changelog_sync.py
See CLAUDE.md for detailed development and release workflows.
License
MIT License - see LICENSE file for details.
Acknowledgments
Built with Typer and Rich for a great CLI experience.
Made for developers who love AI-assisted coding and clean git workflows 🚀
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
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 claude_worktree-0.10.54.tar.gz.
File metadata
- Download URL: claude_worktree-0.10.54.tar.gz
- Upload date:
- Size: 222.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
697b12cd739c2cf9e7655a563a1388cc03b950b0d28738c156c20280e1a8e53f
|
|
| MD5 |
7d676ca3df9b9be5dd372f90ae9f1ef4
|
|
| BLAKE2b-256 |
e442ded005d60cb5d810b0731b554fb63b5ad7d1b09a4caf6dba8c40dea6754b
|
Provenance
The following attestation bundles were made for claude_worktree-0.10.54.tar.gz:
Publisher:
publish.yml on DaveDev42/claude-worktree
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_worktree-0.10.54.tar.gz -
Subject digest:
697b12cd739c2cf9e7655a563a1388cc03b950b0d28738c156c20280e1a8e53f - Sigstore transparency entry: 1121921141
- Sigstore integration time:
-
Permalink:
DaveDev42/claude-worktree@a9892ce94c6b6e322b2a21b15cb3910746189ce6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/DaveDev42
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a9892ce94c6b6e322b2a21b15cb3910746189ce6 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file claude_worktree-0.10.54-py3-none-any.whl.
File metadata
- Download URL: claude_worktree-0.10.54-py3-none-any.whl
- Upload date:
- Size: 109.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18dadd039755a43ecb5026e2d3bdbbdc2f0ea2c152e76d478ce3f1e938443597
|
|
| MD5 |
e97cd6e95626395ee70baa530991b43b
|
|
| BLAKE2b-256 |
83067ce2d51f6fc7da099036652f463cfc6eeec699678386646e786d050e76a6
|
Provenance
The following attestation bundles were made for claude_worktree-0.10.54-py3-none-any.whl:
Publisher:
publish.yml on DaveDev42/claude-worktree
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_worktree-0.10.54-py3-none-any.whl -
Subject digest:
18dadd039755a43ecb5026e2d3bdbbdc2f0ea2c152e76d478ce3f1e938443597 - Sigstore transparency entry: 1121921201
- Sigstore integration time:
-
Permalink:
DaveDev42/claude-worktree@a9892ce94c6b6e322b2a21b15cb3910746189ce6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/DaveDev42
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a9892ce94c6b6e322b2a21b15cb3910746189ce6 -
Trigger Event:
pull_request
-
Statement type: