Skip to main content

General

GWTree is a git worktree manager designed for parallel development. It simplifies creating and managing multiple worktrees, making it perfect for running multiple AI coding agents (Claude Code, Command Code, Cursor) simultaneously on different features.
Git worktrees allow you to have multiple working directories attached to the same repository. Each worktree can have a different branch checked out, enabling you to work on multiple features in parallel without switching branches or stashing changes.Traditional workflow:
With worktrees:
GWTree provides a streamlined interface over git’s native worktree commands:
  • Smart defaults: Automatically handles branch creation, naming, and directory structure
  • Interactive prompts: Guides you through worktree creation
  • Batch creation: Create multiple worktrees with one command
  • Status dashboard: See all worktrees’ status at a glance
  • Smart cleanup: Auto-remove merged worktrees
  • Merge helper: One command to merge, cleanup, and delete branches
  • Editor integration: Automatically opens worktrees in VS Code or Cursor
  • Dependency handling: Auto-installs dependencies in new worktrees
AI coding agents (Claude Code, Command Code, Cursor) work best when they have isolated environments:
  • No conflicts: Each agent works on its own branch
  • Parallel execution: Run multiple agents simultaneously
  • Clean merges: Merge each feature independently when ready
  • Instant setup: gwt a b c -x creates 3 worktrees in seconds
Example workflow:

Installation & Setup

Install globally with npm:
Or with other package managers:
Verify installation:
  • Node.js: 18.0.0 or higher
  • Git: Any recent version
  • Operating System: Linux, macOS, Windows
Optional:
  • VS Code or Cursor (for editor integration)
  • pnpm/yarn/bun (for dependency management)
Configuration is stored in:
  • Config: ~/.config/gwtree/config.json
  • Worktree registry: ~/.gwtree/worktrees.json
Open config file:
Reset to defaults:

Usage

Several ways to create worktrees:Interactive mode:
Quick mode (single name for both worktree and branch):
Fast mode (skip all prompts):
Batch mode (create multiple at once):
Batch + skip editor:
Press ESC when prompted for “Worktree & branch name:” to enter separate names.Example:
  1. Run gwt
  2. Press ESC at the name prompt
  3. Enter worktree name: login-feature
  4. Enter branch name: feature/user-authentication
Result: Creates repo-login-feature/ directory with feature/user-authentication branch.
Shows all worktrees for the current repository with their paths and branch names.
Shows for each worktree:
  • Uncommitted changes
  • Commits ahead/behind main
  • Merge status
  • Added/deleted lines
Output example:
Interactive removal:
Remove merged worktrees:
Remove all worktrees:
The merge command automates the entire merge workflow:
This command:
  1. Switches to main branch
  2. Merges the feature branch
  3. Removes the worktree
  4. Deletes the feature branch
The worktree must have no uncommitted changes to merge.

Configuration

Open config file:
Set editor to one of:
  • "code" - VS Code (default)
  • "cursor" - Cursor
  • "default" - System default editor ($EDITOR)
  • "none" - Don’t open editor
Or skip editor for a single command:
Open config file:
Set installDeps to false:
GWTree detects your package manager by checking for lock files:
  1. pnpm-lock.yaml → pnpm
  2. bun.lockb → bun
  3. yarn.lock → yarn
  4. package-lock.json → npm
  5. package.json (no lock file) → pnpm
The detected package manager is saved in lastPm config and used for future worktrees.
The naming pattern is currently fixed as {repo}-{name}. For example:
  • Repository: my-app
  • Name: feature-login
  • Worktree directory: my-app-feature-login
To use different names, press ESC during creation and enter separate worktree and branch names.

Workflow

When creating a worktree, GWTree detects uncommitted changes and offers options:
  1. Stash changes: Saves changes with git stash (recommended)
  2. Ignore and continue: Leaves changes in current worktree
  3. Cancel: Aborts worktree creation
To skip prompts:
No. GWTree handles branch switching automatically:
  • If you’re not on main/master, it prompts to switch
  • In fast mode (-y), it switches automatically
  • Worktrees are always created from the main branch
If installDeps is enabled (default), GWTree:
  1. Detects package manager in the new worktree
  2. Runs install command (pnpm install, npm install, etc.)
  3. Shows install status in the output
Dependencies are installed independently in each worktree, so different worktrees can have different versions.
Yes! GWTree creates standard git worktrees. You can always use native git commands:
GWTree is a convenience wrapper that makes worktree management easier.

Troubleshooting

If you delete a worktree directory manually, git keeps a stale reference.Solution:
GWTree runs this automatically when creating worktrees.
gwt ls shows only worktrees created by GWTree. It reads from ~/.gwtree/worktrees.json.To see all worktrees (including manually created ones):
If you chose “Stash changes” when creating a worktree:
  1. Navigate to the original worktree (usually main repo)
  2. Apply the stash:
List all stashes: