cc -w flag converts '/' to '+' in worktree path, fails to enter nested worktrees
Resolved 💬 3 comments Opened Apr 14, 2026 by AldenioBurgos Closed Apr 18, 2026
Bug Description
The cc -w <path> flag sanitizes / characters in the worktree path to +, which prevents entering worktrees that live in nested subdirectories.
Steps to Reproduce
- Create a git worktree with a
/in the branch name (common for branch naming conventions likechange/2026-04-14-my-feature):
git worktree add .claude/worktrees/change/2026-04-14-my-feature -b change/2026-04-14-my-feature
- Try to open Claude Code in that worktree:
cc -w change/2026-04-14-my-feature
Expected Behavior
Claude Code should open with the working directory set to:
~/projects/myrepo/.claude/worktrees/change/2026-04-14-my-feature
Actual Behavior
Claude Code opens with the working directory set to a non-existent path where / was replaced by +:
~/projects/myrepo/.claude/worktrees/change+2026-04-14-my-feature
This is visible in the Claude Code header:
~/projects/staking/.claude/worktrees/change+2026-04-14-update-eth-watcher-dr0-ethh-validator
Workaround
cd into the worktree directory first, then run cc without -w:
cd .claude/worktrees/change/2026-04-14-my-feature
cc
Environment
- Claude Code v2.1.108
- macOS (Darwin 25.3.0)
- zsh
- Git worktrees created via
git worktree add
Context
Branch naming conventions like change/YYYY-MM-DD-slug or feature/xyz are very common. The -w flag should handle / in paths correctly since nested worktree directories are a natural result of these conventions.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗