| name | git-worktree |
| description | Use this skill for isolated branch workflows and parallel development. Activates when working on features that need isolation, switching contexts, or managing multiple branches. |
Git Worktree Skill
Manage isolated development branches without stashing or losing context.
Core Principle
Each feature gets its own workspace.
Git worktrees let you have multiple branches checked out simultaneously in different directories—no stashing, no context switching pain.
What is a Worktree?
my-project/ # main branch (main worktree)
my-project-feature-auth/ # feature/auth branch (linked worktree)
my-project-bugfix-123/ # bugfix/123 branch (linked worktree)
Each worktree:
- Has its own working directory
- Shares the same .git data (efficient)
- Can have different branches checked out
- Allows true parallel development
Worktree Commands
Create a Worktree
git worktree add ../project-feature-name -b feature/name
git worktree add ../project-feature-name feature/name
List Worktrees
git worktree list
Remove a Worktree
git worktree remove ../project-feature-name
git worktree remove --force ../project-feature-name
Prune Stale Worktrees
git worktree prune
Workflow: Feature Development
1. Start Feature
git worktree add ../myproject-auth -b feature/auth
cd ../myproject-auth
npm test
2. Develop in Isolation
npm run dev
git commit -m "feat: add login form"
3. Stay Updated with Main
git fetch origin main
git rebase origin/main
git merge origin/main
4. Complete Feature
npm test
git push -u origin feature/auth
cd ../myproject
git worktree remove ../myproject-auth
git branch -d feature/auth
Workflow: Hotfix While Feature in Progress
cd ../myproject
git worktree add ../myproject-hotfix -b hotfix/critical-bug
cd ../myproject-hotfix
git commit -m "fix: critical bug"
git push -u origin hotfix/critical-bug
git worktree remove ../myproject-hotfix
cd ../myproject-auth
git fetch origin main
git rebase origin/main
Best Practices
Naming Convention
<project>-<type>-<name>
myapp-feature-auth
myapp-bugfix-123
myapp-hotfix-critical
myapp-experiment-new-approach
Directory Structure
~/code/
├── myapp/ # main (always main/master)
├── myapp-feature-auth/ # feature branch
├── myapp-feature-dashboard/ # another feature
└── myapp-hotfix-123/ # hotfix
Test Baseline Before Starting
npm install
npm test
Don't Forget Cleanup
git worktree remove ../path-to-worktree
git branch -d branch-name
Common Issues
"fatal: 'branch' is already checked out"
git worktree list
Shared node_modules?
cd ../new-worktree
npm install
IDE Confusion
Integration with Development Flow
With /riper
git worktree add ../project-feature -b feature/x
With /handoff
worktrees:
- path: ../project-feature-auth
branch: feature/auth
status: in_progress
notes: Working on OAuth integration
With /ledger
active_worktrees:
- feature/auth: 75% complete
- hotfix/123: ready for review
Benefits vs Traditional Workflow
| Aspect | Stash/Switch | Worktrees |
|---|
| Context loss | High | None |
| Speed | Slow | Instant |
| Parallel work | Hard | Easy |
| Mental overhead | High | Low |
| Disk space | Same | Slightly more |