CLSkills
Git & Version Controladvanced

Git Worktree Setup

Share

Set up and manage git worktrees for parallel development

Git Worktree Setup

Set up and manage git worktrees for parallel development

Set up git worktrees for parallel development.

Instructions

  1. List existing worktrees:
git worktree list
  1. Create a worktree for a different branch:
# Work on a hotfix while keeping current branch open
git worktree add ../my-repo-hotfix hotfix/critical-bug

# Create a new branch in a worktree
git worktree add ../my-repo-feature -b feature/new-feature
  1. Work in the new directory:
cd ../my-repo-hotfix
# Make changes, commit, push — it's a separate working directory
# but shares the same .git repo
  1. Remove worktree when done:
cd ../my-repo              # go back to main worktree
git worktree remove ../my-repo-hotfix
# or: rm -rf ../my-repo-hotfix && git worktree prune

When to Use Worktrees

  • Reviewing a PR while working on something else
  • Running long tests on one branch while coding on another
  • Comparing behavior between branches side-by-side
  • Hotfix while in the middle of a feature

Tips

  • Each worktree can only have one branch checked out (no duplicates)
  • npm install may be needed separately in each worktree

Quick Info

Difficultyadvanced
Version1.0.0
AuthorClaude Skills Hub
gitworktreeparallel

Install command:

curl -o ~/.claude/skills/git-worktree-setup.md https://claude-skills-hub.vercel.app/skills/git/git-worktree-setup.md