Git Worktree Manager
This skill ships a helper script:
scripts/worktree-manager.sh
It wraps git worktree and also:
- keeps worktrees under
.worktrees/ - copies common
.env*files from the main repo into new worktrees - ensures
.worktrees/is in.gitignore
Usage
Create a worktree
bash scripts/worktree-manager.sh create <branch-name> [from-branch]
Example:
bash scripts/worktree-manager.sh create feat-login main
List worktrees
bash scripts/worktree-manager.sh list
Switch (prints target path)
bash scripts/worktree-manager.sh switch <branch-name>
Copy env files into an existing worktree
bash scripts/worktree-manager.sh copy-env <branch-name>
Cleanup inactive worktrees
bash scripts/worktree-manager.sh cleanup
Notes
- Prefer using this script instead of calling
git worktree adddirectly. - If your default branch is not
main, pass it explicitly asfrom-branch.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.