Git Worktree (wtp)
wtp is a CLI for managing git worktrees. Work on multiple branches at the same time without stashing or switching.
When to use it
Section titled “When to use it”- Working on multiple branches simultaneously
- Comparing two implementations side by side
- Reviewing a PR in a separate directory
Basics
Section titled “Basics”# List worktreeswtp list
# Add a worktree for a feature branchwtp add feature/user-auth
# Specify a custom pathwtp add feature/api-refactor ../project-api-refactor
# Remove after mergingwtp remove feature/user-auth
# Switch to a worktreewtp switch feature/user-auth
# Clean up stale entrieswtp pruneDirectory naming convention
Section titled “Directory naming convention”../project-<type>-<description>Types: feature, bugfix, hotfix, experiment, refactor
Config
Section titled “Config”Create .wtp.local.yml for personal overrides (already gitignored):
default_path: "../worktrees"auto_cleanup: trueRecipes
Section titled “Recipes”Hotfix during feature work
Section titled “Hotfix during feature work”# Working on a featurecd ~/project-feature-auth
# Urgent bug comes inwtp add hotfix/critical-bugcd ../project-hotfix-critical-bug
# Fix, push, go back to featurecd ~/project-feature-auth
# Clean up after mergewtp remove hotfix/critical-bugComparing approaches
Section titled “Comparing approaches”# Approach Awtp add experiment/approach-acd ../project-experiment-approach-a
# Approach Bwtp add experiment/approach-bcd ../project-experiment-approach-b
# Compare and keep the better oneLocal PR review
Section titled “Local PR review”wtp add review/pr-123 origin/pull/123cd ../project-review-pr-123
# Review, then clean upwtp remove review/pr-123Interactive mode (wt + skim)
Section titled “Interactive mode (wt + skim)”| Command | What it does |
|---|---|
wt | Interactive menu (also Alt+W) |
wt list | List worktrees |
wt cd | Switch to worktree (interactive) |
wt add | Create worktree |
wt rm | Remove worktree (with confirmation) |
Shortcuts: wtcd, wtadd, wtrm, wtls
Keybinding: Alt+W opens the menu.
The preview shows recent commits and git status.