| name | wm-git-worktree-manager |
| description | Use when working with git worktrees - creating isolated workspaces for branches, managing multiple features in parallel, or cleaning up worktrees |
WM - Git Worktree Manager
CLI tool for easy git worktree management.
IMPORTANT: Non-Interactive Mode Required
Always use explicit arguments. Interactive mode does not work in automated environments.
wm add feature-auth
wm remove feature-auth
wm add
wm remove
Quick Reference
| Command | Description |
|---|
wm init | Initialize project config (.wm.yaml) |
wm add <branch> | Create worktree for branch |
wm add <branch> -p <path> | Create worktree at custom path |
wm list | List all worktrees |
wm remove <branch> | Remove worktree by branch name |
wm remove <path> | Remove worktree by path |
wm remove -b <branch> | Remove worktree AND delete branch |
wm remove -f <branch> | Force remove (skip confirmation) |
Common Patterns
Create Worktree
wm add feature-login
wm add feature-login -p ./workspaces/login
wm add feature/auth
Remove Worktree
wm remove feature-auth
wm remove ../wm_repo/feature-auth
wm remove -b feature-auth
wm remove -f feature-auth
List Worktrees
wm list
wm ls
Configuration (.wm.yaml)
version: 1
worktree:
base_dir: "../wm_{repo}"
sync:
- ".env"
- "apps/*/.env"
- src: ".env.example"
dst: ".env"
mode: copy
when: missing
tasks:
post_install:
mode: background
commands:
- "npm install"
When to Use
- Working on multiple features in parallel
- Reviewing PRs while continuing other work
- Running long builds/tests on separate branch
- Quick branch switching without stash
Common Mistakes
| Mistake | Solution |
|---|
| Using interactive mode | Always provide branch/path argument |
Expecting nested folders for feature/auth | Creates feature-auth (flat) since v0.1.1 |
| Trying to remove main worktree | Not allowed - main worktree is protected |
| Branch used by another worktree | Warning shown, requires confirmation |