Skip to main content
Git worktrees revolutionize feature development by giving each feature its own isolated directory. Work on multiple features simultaneously without branch switching, stashing, or context loss.

The Problem with Traditional Workflow

Traditional git workflow forces you to:
  • Switch branches constantly
  • Stash uncommitted changes
  • Lose IDE context and open files
  • Reinstall dependencies after switching
  • Close and reopen terminals
Worktrees solve all of this.

Feature Development Flow

1

Start a new feature

Create a worktree for your feature:
This creates:
  • A new branch: feature-login
  • A new directory: repo-feature-login/
  • Pulls latest from main automatically
Your editor opens automatically (VS Code or Cursor based on your config).
2

Develop in isolation

Work normally in the worktree:
Make changes, commit as you go:
3

Switch to another feature

Need to work on something else? Just create another worktree:
The -x flag skips opening an editor. Your first feature stays untouched:
  • All files exactly as you left them
  • Dev server still running
  • No stashing needed
4

Check status across features

View progress on all your features:
Output shows:
  • Uncommitted changes in each worktree
  • Commits ahead/behind main
  • Merge status
5

Complete and merge

When your feature is ready:
The merge command handles everything:
  • Switches to main
  • Merges the branch
  • Removes the worktree
  • Deletes the local branch

Common Scenarios

Multiple Related Features

Work on related features in parallel:
Develop all three simultaneously, test interactions between them.

Feature + Hotfix

Feature work interrupted by urgent bug:
Your feature work remains untouched.

Long-Running Features

Keep long-running feature branches fresh:

Experimental Work

Try risky changes without fear:

Fast Creation Modes

Quick Mode

Create worktree with a single name:

Fast Mode (Skip Prompts)

Use -y to skip all prompts and use saved defaults:

Batch Mode

Create multiple worktrees at once:

Ultra-Fast Mode

Combine flags for instant creation:

Configuration Tips

Set your preferred editor globally:
Options:
  • code - VS Code
  • cursor - Cursor
  • none - Don’t open editor
  • default - System default
Config stored in ~/.config/gwtree/config.json:

Cleaning Up

Clean up features that have been merged to main:
Safely removes only merged worktrees.
Start fresh by removing all worktrees:
Use with caution - removes all worktrees including unmerged work.
Interactive search and remove:
Select the worktree to remove from a list.
See all your worktrees:

Best Practices

Keep main worktree clean - Use the main repository directory for quick checks and worktree management only.
Name worktrees descriptively - Use clear names like feature-user-auth or fix-payment-bug so you know what each worktree contains.
Don’t nest worktrees - Create all worktrees as siblings to your main repository, not inside it.

Troubleshooting

Each worktree can run its own dev server on a different port:
Each worktree has its own node_modules:
If you encounter conflicts when merging:

Next Steps

Parallel Agents

Run multiple AI agents simultaneously on different features.

Code Review

Review PRs without disrupting your current work.