Claude Code と連携した、git worktree ベースの並行開発環境
複数のタスクを並行して管理し、ブランチ切り替えの煩わしさから解放されます。
- 🌳 git worktree ベース: 各タスクが独立したディレクトリで管理される
- 🔀 マルチリポジトリ対応: 複数リポジトリの横断開発をサポート
- 🎨 IDE 統合: Cursor/VS Code のマルチルートワークスペース自動生成
- 🤖 Claude Code 連携: AI アシスタントとの統合開発環境
- 📦 リポジトリグループ: よく使う組み合わせを定義可能
- 🚀 高速切り替え: fzf による対話的なタスク選択
zclaude feature-ui my-monorepo# 複数サービスの横断開発
zclaude feature-api backend-api frontend-app auth-service
# またはグループを使用
zclaude feature-api @backend# OSS プロジェクトへの貢献
zclaude bugfix-123 react
# 複数 PR を並行管理
zclaude feature-a react
zclaude bugfix-b react
ztasks # タスク一覧から切り替え- zsh
- git
- fzf (for interactive task selection)
- Warp or any terminal emulator (optional, for enhanced UX)
git clone https://github.com/nyohoo/git-worktree-manager.git
cd git-worktree-manager
./install.shThe installer will guide you through:
- Setting up your repository root directory
- Configuring the worktree location
- Adding configuration to
.zshrc
# 1. Copy files
mkdir -p ~/.config/gwm
cp gwm.zsh ~/.config/gwm/
cp groups.conf ~/.config/gwm/
# 2. Add to .zshrc
cat >> ~/.zshrc << 'EOF'
# Git Worktree Manager
export GWT_REPOS_ROOT="$HOME/repos"
export GWT_WORKTREE_ROOT="$GWT_REPOS_ROOT/worktrees"
export GWT_BASE_BRANCH="main"
export GWT_GROUPS_FILE="$HOME/.config/gwm/groups.conf"
source ~/.config/gwm/gwm.zsh
EOF
# 3. Reload shell
source ~/.zshrc# 1. Create a task
zclaude feature-api backend
# 2. Edit with Claude Code (automatically launched)
cd $GWT_WORKTREE_ROOT/feature-api/backend
claude
# 3. Test in main repository
ztest feature-api
# 4. Clean up when done
zclean feature-api- User Guide - Detailed usage guide
- Contributing - How to contribute
- License - MIT License
| Command | Description |
|---|---|
zclaude <task> [repos...] |
Create a new task with specified repositories |
zpull <PR-URL> |
Create worktree from GitHub PR URL |
zadd <repos...> |
Add repositories to current task |
ztest <task> |
Switch main repositories to task branch |
zclean <task> |
Clean up task and worktrees |
ztasks |
List and select tasks (fzf) |
zcursor [task] |
Open task in Cursor |
zprune |
Clean up branches and worktrees interactively |
# Required
export GWT_REPOS_ROOT="$HOME/repos" # Repository root directory
# Optional
export GWT_WORKTREE_ROOT="$GWT_REPOS_ROOT/wt" # Worktree location (default: $GWT_REPOS_ROOT/worktrees)
export GWT_BASE_BRANCH="main" # Base branch (default: main)
export GWT_GROUPS_FILE="$HOME/.config/gwm/groups.conf" # Groups fileDefine common repository combinations in ~/.config/gwm/groups.conf:
# Backend services
backend=api-gateway,auth-service,user-service
# Frontend apps
frontend=web-app,mobile-app
# Full stack
fullstack=api-gateway,auth-service,web-app
Usage:
zclaude feature-api @backend @frontend
zadd @fullstackzclaude feature-api backend
# Edit in worktree
cd $GWT_WORKTREE_ROOT/feature-api/backend
# Test in main
ztest feature-api# Create task with multiple repos
zclaude feature-integration backend frontend
# Add more repos later
cd $GWT_WORKTREE_ROOT/feature-integration/backend
zadd auth-service
# Open all in Cursor
zcursor feature-integration# List all tasks
ztasks
# Switch between tasks (no stash needed!)
cd $GWT_WORKTREE_ROOT/task-a/backend # Work on task A
cd $GWT_WORKTREE_ROOT/task-b/frontend # Work on task B# Create worktree from PR URL
zpull https://github.com/heyinc/rsv-rails/pull/27158
# Review the code
cd $GWT_WORKTREE_ROOT/fix-bug-urgent/rsv-rails
# Test the changes
ztest fix-bug-urgent
# Clean up after review
zclean fix-bug-urgent$GWT_REPOS_ROOT/
├── backend/ # Main repository (for testing)
├── frontend/ # Main repository
└── worktrees/ # Worktree area
├── feature-api/
│ ├── backend/ # git worktree
│ ├── .workspace # Metadata
│ └── feature-api.code-workspace # Cursor workspace
└── bugfix-login/
├── auth-service/
└── ...
Normal branch switching:
git checkout feature-A- Requires stash when switching between branches
- "Which branch am I on?" confusion
Worktree:
- Each branch has its own physical directory
- Switching is just
cd - No stash needed, no confusion
Yes. Worktrees only manage code. The database is shared. Be careful when testing migrations.
Technically yes, but watch out for port conflicts. Generally recommended to run only one server at a time.
Git Worktree Manager includes Raycast Script Commands for quick access to your tasks.
| Command | Description |
|---|---|
| 📦 List Worktree Tasks | Show all active tasks with details |
| 🎨 Open Task in Cursor | Open a task in Cursor editor |
| 🖥️ Open Task in Terminal | Open a task directory in terminal |
| 📋 Copy Task Path | Copy task path to clipboard |
-
Install Raycast:
brew install --cask raycast
-
Add Script Commands directory:
- Open Raycast → Extensions → "+" → Add Script Directory
- Select:
~/.config/gwm/raycast
-
Start using:
- Press
⌘ + Spaceto open Raycast - Type "list worktree" or "open task"
- Press
See raycast/README.md for detailed setup and customization.
Contributions are welcome! See CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
- Built with love for developers tired of
git stash - Optimized for Claude Code integration
- Inspired by multi-repository development workflows
- GitHub: https://github.com/nyohoo/git-worktree-manager
- Issues: https://github.com/nyohoo/git-worktree-manager/issues
- Discussions: https://github.com/nyohoo/git-worktree-manager/discussions
Happy Coding! 🚀