tree-me — Git Worktree Management
tree-me manages git worktrees organized at $WORKTREE_ROOT/<repo>/<branch> (default: ~/dev/worktrees).
Commands
| Command | Description |
|---|---|
tree-me create <branch> [base] |
Create new branch in a worktree (base defaults to main/master) |
tree-me checkout <branch> |
Checkout existing branch in a new worktree |
tree-me pr <number|url> |
Checkout a GitHub PR in a worktree (uses gh) |
tree-me list |
List all worktrees |
tree-me remove <branch> |
Remove a worktree |
tree-me prune |
Remove stale worktree admin files |
Key Behaviors
- Idempotent: If a worktree for the branch already exists, prints its path instead of erroring.
- Auto-cd: If the user has
source <(tree-me shellenv)in their shell config, the shell auto-cds into the new worktree aftercreate/checkout/pr. - PR branches:
tree-me pr 123creates a local branch namedpr-123and checks it out. coandrmandlsare aliases forcheckout,remove, andlist.
Worktree Path Convention
~/dev/worktrees/<repo-name>/<branch-name>/
Override root with WORKTREE_ROOT env var.
Common Workflows
Start isolated work on a new feature:
tree-me create my-feature # branches from main
tree-me create my-feature develop # branches from develop
Review a PR without disturbing current work:
tree-me pr 456
Clean up after merging:
tree-me remove my-feature
When Helping the User
- Prefer
tree-me createfor new work,tree-me checkoutfor existing branches. - After creating a worktree, remind the user to
cdinto it (or that auto-cd handles it if shellenv is sourced). - Use
tree-me listto check existing worktrees before creating a duplicate. tree-me pruneis safe to run when worktrees have been deleted manually.