Run a session in an isolated git worktree

sessions

// what it does

claude -w feature-auth (or --worktree) starts the session inside a managed git worktree branched from origin/HEAD, so several sessions can edit different branches at once without colliding over one checkout. With no name it auto-generates one. Worktrees are created under .claude/worktrees/<name>/; add --tmux to open the worktree in its own tmux session.

// shell

$ claude -w feature-auth
$ claude --worktree
$ claude -w bugfix-123 --tmux

// gotcha

A worktree left with uncommitted changes is not deleted on exit — Claude prompts you to keep or remove it. Add .claude/worktrees/ to .gitignore so the managed worktrees never get committed into the repo.

// resources