Worktree Commands
Work on multiple branches simultaneously without stashing. Git worktrees let you check out different branches in separate directories, perfect for code reviews, hotfixes, or comparing implementations.
8 commands
Pro Tips
Use worktrees instead of stashing when you need to switch context frequently between branches.
Create worktrees in a sibling directory pattern: 'git worktree add ../project-feature feature-branch'
Worktrees share the .git directory, so fetches and commits in one are immediately visible in others.
Common Mistakes
You cannot check out the same branch in multiple worktrees simultaneously - Git prevents this to avoid conflicts.
Remove worktrees with 'git worktree remove' - don't just delete the folder, or Git's internal state becomes inconsistent.