Quick Start
Create a worktree with default settings:Interactive Workflow
When you rungwt without arguments, you’ll be guided through an interactive workflow:
git stash to save your changes/path/to/parent/myrepo-<name>
Press ESC to set worktree and branch names separately
◆ Worktree & branch name:
│ feature-name
│
│ ◆ Prune git worktree prune
│ └ removes stale refs
│
│ ◆ Create git worktree add -b "feature-name" .../myrepo-feature-name "main"
│ └ /path/to/parent/myrepo-feature-name
│
│ ◆ Install pnpm install
│ └ installs dependencies
│
│ ◆ Open code .../myrepo-feature-name
│ └ opens in editor
│
└ Done cd ../myrepo-feature-name
Branch Name Conflicts
If a branch with your chosen name already exists, GWTree automatically appends a counter:Skip Prompts Mode
Use the-y or --yes flag to skip all interactive prompts and use defaults:
-y flag:
- Uncommitted changes are automatically stashed
- Automatically switches to main branch
- Automatically pulls from remote
- No editor/dependency prompts (uses saved config)
Skip Editor
Prevent opening the editor after creation:Examples
Create with Interactive Prompts
Create with Name Argument
Quick Creation (Skip All Prompts)
Create Without Opening Editor
Valid Names
Worktree and branch names must match the pattern:[a-zA-Z0-9._/-]+
Valid examples:
feature-nameuser/john/featurefeat.new-api123-bug-fix
feature name(spaces not allowed)feature@name(@ not allowed)
What Happens Under the Hood
When you create a worktree, GWTree:- Detects your git repository root
- Identifies the main branch (main or master)
- Creates the worktree directory at the same level as your repo
- Creates a new branch from main
- Records the worktree in
~/.gwtree/worktrees.json - Detects package manager from lockfiles (pnpm-lock.yaml, package-lock.json, etc.)
- Installs dependencies if configured
- Opens in your configured editor
Next Steps
- Learn about batch creation to create multiple worktrees at once
- Configure automatic behaviors like editor and dependency installation
- Explore managing worktrees with list, status, and remove commands