---
tags: [tech-patterns, auto-generated]
source: 3m-portal
created: 2026-05-05
---

# Using Git Worktrees for Parallel Claude Development Sessions

## When to use
Use git worktrees when you need to run multiple independent Claude sessions simultaneously on different branches without context switching or stashing work.

## Prerequisites
- Git 2.7+
- A repository with multiple branches
- Multiple Claude sessions (or ability to open new ones)

## Steps
1. Create a new worktree for your branch:
   ```bash
   git worktree add ../path-to-worktree branch-name
   ```

2. Navigate to the worktree directory:
   ```bash
   cd ../path-to-worktree
   ```

3. Start a new Claude session in this worktree directory

4. Each session works independently on its own branch without affecting others

5. When done, remove the worktree:
   ```bash
   git worktree remove ../path-to-worktree
   ```

## Key Configuration
- Main worktree location: `project-root/`
- Secondary worktrees: `project-root-worktree-name/` (sibling directories recommended)
- Each worktree maintains its own git state, node_modules, and build artifacts

## Gotchas
- **Shared dependencies**: `node_modules` and build caches are duplicated per worktree—can consume significant disk space
- **Long-running worktrees**: Clean up finished worktrees promptly to avoid confusion
- **Hotfix scenarios**: Best practice is to always create worktrees for hotfix/feature branches, never work directly on main worktree
- **Multiple branch work**: If a branch has uncommitted changes, `git worktree add` will fail—commit or stash first

## Source
Project: 3m-portal
