| name | gtr-workflow |
| description | Git Worktree Runner (gtr) workflow guidance for parallel development with Claude Code. Use when the user asks about git worktrees, parallel AI development, running multiple Claude sessions, managing worktrees with gtr, or setting up isolated development environments for feature work. |
gtr (Git Worktree Runner) Workflow
git gtr is a CLI tool that wraps git worktree with quality-of-life features for parallel AI-assisted development.
Core Commands
git gtr new <branch>
git gtr editor <branch>
git gtr ai <branch>
git gtr go <branch>
git gtr run <branch> <cmd>
git gtr rm <branch>
git gtr list
git gtr copy <branch> -- <pattern>
Special ID 1 references the main repo: git gtr go 1, git gtr ai 1
Installation
git clone https://github.com/coderabbitai/git-worktree-runner.git
cd git-worktree-runner
sudo ln -s "$(pwd)/bin/git-gtr" /usr/local/bin/git-gtr
Initial Setup (per repository)
cd ~/your-project
git gtr config set gtr.editor.default cursor
git gtr config set gtr.ai.default claude
ブランチの起点に注意(重要)
git gtr new <branch> はデフォルトで gtr.defaultBranch(通常は develop や main)からブランチを作成する。
featureブランチから派生させたい場合は必ず --from-current または --from を指定すること。
git gtr new feature/child-branch --from-current
git gtr new feature/child-branch --from feature/parent-branch
git gtr new feature/child-branch
Parallel Development Workflow
Single Feature with Claude Code
git gtr new feature-auth
git gtr ai feature-auth
git gtr rm feature-auth
Multiple Parallel Claude Sessions
git gtr new feature-api
git gtr ai feature-api
git gtr new feature-ui
git gtr ai feature-ui
git gtr new feature-tests
git gtr ai feature-tests
Each session has isolated context - no stashing, no branch switching.
Same Branch, Multiple Worktrees
Use --force with --name for parallel work on the same feature:
git gtr new feature-auth
git gtr new feature-auth --force --name backend
git gtr new feature-auth --force --name frontend
PR Review While Working
git gtr new my-feature
git gtr ai my-feature
git gtr new review-pr-123 --from origin/pr-branch
git gtr editor review-pr-123
git gtr rm review-pr-123
Configuration
Team-Shared Config (.gtrconfig)
Create .gtrconfig in repo root:
[copy]
include = **/.env.example
include = **/CLAUDE.md
exclude = **/.env
[copy]
includeDirs = node_modules
excludeDirs = node_modules/.cache
[hooks]
postCreate = npm install
[defaults]
editor = vscode
ai = claude
Copy Files to Worktrees
git gtr config add gtr.copy.include "**/.env.example"
git gtr config add gtr.copy.include "**/CLAUDE.md"
git gtr config add gtr.copy.includeDirs "node_modules"
Post-Create Hooks
git gtr config add gtr.hook.postCreate "npm install"
git gtr config add gtr.hook.postCreate "cp .env.example .env"
Branch Name Mapping
Slashes and special characters become hyphens:
feature/user-auth → folder feature-user-auth
fix/bug#123 → folder fix-bug-123
Worktree作成前の確認
1. .gtrconfig の確認
worktree作成前に、プロジェクトルートに .gtrconfig が存在するか確認する。
なければ以下の内容で作成し、コミットする:
[copy]
include = **/.env*
include = **/CLAUDE.md
[hooks]
postCreate = npm install
これにより、worktree作成時に自動で npm install が実行される。
2. ベースブランチの確認
現在のブランチが develop / main 以外(featureブランチ等)の場合、
worktree作成時に 必ず --from-current を付けること。
付け忘れると develop ベースになり、featureブランチの変更が含まれない。
git gtr new feature/child --from-current
Best Practices
- One worktree per task - Keep Claude sessions focused
- Copy CLAUDE.md - Include project context in each worktree
- Use hooks - Automate dependency installation
- Clean up regularly -
git gtr rm when PRs merge
- Use
git gtr list - Track active worktrees
Troubleshooting
git gtr doctor
git gtr adapter
git gtr clean
git gtr clean --merged