This guide explains how to use git worktrees for parallel development in the dotfiles repository.
Git worktrees allow you to have multiple branches checked out simultaneously in different directories. This is perfect for:
- Working on multiple features in parallel
- Testing changes in isolation
- Keeping your main repo clean while experimenting
# From the main dotfiles directory
cd ~/ppv/pillars/dotfiles
# Create a new worktree with a new branch
git worktree add -b feature/my-feature worktrees/feature/my-feature
# Or use an existing branch
git worktree add worktrees/fix/existing-fix fix/existing-fixIMPORTANT: Each worktree needs its own environment setup to work properly.
# Navigate to your worktree
cd ~/ppv/pillars/dotfiles/worktrees/feature/my-feature
# Source setup.sh from the worktree directory
source setup.shThis will:
- Set
DOT_DENto the worktree directory - Add the worktree's MCP directories to PATH
- Install all MCP server dependencies locally in the worktree
- Build/copy all necessary binaries to the worktree
The setup process ensures all MCP servers work correctly in worktrees by:
- Installing npm packages: MCP dependencies installed in
worktree/node_modules - Generating configs: MCP configurations are generated for the worktree path
After setup, MCP servers configured in Claude desktop settings should work normally.
Solution: Run source setup.sh from the worktree directory to build/install dependencies
Solution: The setup script should install them. If not, run:
npm installWhen you're done with a worktree:
# From anywhere
git worktree remove ~/ppv/pillars/dotfiles/worktrees/feature/my-feature
# Or force remove if there are uncommitted changes
git worktree remove -f ~/ppv/pillars/dotfiles/worktrees/feature/my-feature- Always source setup.sh from the worktree directory after creating it
- Keep worktrees organized in the
worktrees/subdirectory - Name worktrees after their branch for easy identification
- Clean up worktrees when done to save disk space
- Don't share binaries between worktrees - each should be self-contained
The setup works because:
DOT_DENis set to the directory where setup.sh is sourced from- All scripts use
$DOT_DENor relative paths from their location - MCP wrapper scripts resolve paths relative to their own location
- Each worktree gets its own complete set of dependencies
This follows the "Spilled Coffee Principle" - if your laptop dies, you can recreate any worktree by just running source setup.sh from it.