Getting Started¶
Prerequisites¶
| Dependency | Purpose | Required |
|---|---|---|
| macOS | AppleScript automation for iTerm2 | Yes |
| iTerm2 | Terminal emulator with scriptable windows/panes | Yes |
| git | Worktree operations | Yes |
GitHub CLI (gh) |
Pull request creation via wt merge --pr |
Optional |
Installation¶
Verify the installation:
Shell Completions¶
Enable tab completion for worktree names, branch names, and flags.
Add to ~/.zshrc for session completions:
Or install persistently:
Add to ~/.bashrc for session completions:
Or install persistently (macOS with Homebrew):
Your First Worktree¶
This walkthrough creates a feature branch, does some work, syncs with main, and merges.
1. Create a worktree¶
This creates a git worktree with a new feature/my-feature branch and opens an iTerm2 window with two panes:
- Top pane: Claude Code session (
claude) - Bottom pane: Shell for running commands
The worktree directory is created as a sibling to your repo:
2. List your worktrees¶
Worktrees for my-repo
BRANCH PATH WINDOW STATUS AGE
feature/my-feature .../my-repo.worktrees/my-feature open clean 1m
3. Sync with main¶
After working on your feature, pull in the latest changes from main:
This fetches from the remote (if one exists), reports ahead/behind status, and merges main into your feature branch.
Tip
Use wt sync feature/my-feature --rebase to rebase onto main instead of merging, producing a linear history.
4. Merge and clean up¶
When your feature is ready:
# Local merge into main + auto-cleanup
wt merge feature/my-feature
# Or create a pull request instead
wt merge feature/my-feature --pr
Local merge performs the merge, pushes (if remote exists), removes the worktree, closes the iTerm2 window, and cleans up state — all in one command.
5. Shorthand access¶
If you close the iTerm2 window and want to reopen it later:
Any unrecognized command is treated as a branch name, so wt my-feature is equivalent to wt open my-feature.