claude-code - 💡(How to fix) Fix cc -w flag converts '/' to '+' in worktree path, fails to enter nested worktrees [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48080Fetched 2026-04-15 06:33:48
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
0
Timeline (top)
commented ×1

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.

Root Cause

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.

Fix Action

Workaround

cd into the worktree directory first, then run cc without -w:

cd .claude/worktrees/change/2026-04-14-my-feature
cc

Code Example

git worktree add .claude/worktrees/change/2026-04-14-my-feature -b change/2026-04-14-my-feature

---

cc -w change/2026-04-14-my-feature

---

~/projects/myrepo/.claude/worktrees/change/2026-04-14-my-feature

---

~/projects/myrepo/.claude/worktrees/change+2026-04-14-my-feature

---

~/projects/staking/.claude/worktrees/change+2026-04-14-update-eth-watcher-dr0-ethh-validator

---

cd .claude/worktrees/change/2026-04-14-my-feature
cc
RAW_BUFFERClick to expand / collapse

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

  1. Create a git worktree with a / in the branch name (common for branch naming conventions like change/2026-04-14-my-feature):
git worktree add .claude/worktrees/change/2026-04-14-my-feature -b change/2026-04-14-my-feature
  1. 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.

extent analysis

TL;DR

The issue can be worked around by changing into the worktree directory before running cc without the -w flag.

Guidance

  • The problem seems to stem from the cc -w flag incorrectly sanitizing / characters in worktree paths to +, which leads to incorrect directory navigation.
  • To verify the issue, try creating a worktree with a / in its path and then attempt to open it with cc -w.
  • As a temporary workaround, use the provided method of changing into the worktree directory first and then running cc without the -w flag.
  • Consider reviewing the documentation or source code of cc to understand how it handles worktree paths and the -w flag, which might provide insight into a more permanent fix.

Example

cd .claude/worktrees/change/2026-04-14-my-feature
cc

Notes

This workaround assumes that the issue is specifically with the -w flag's handling of / characters in worktree paths. If the problem persists or the workaround is not feasible, further investigation into cc's handling of worktree paths may be necessary.

Recommendation

Apply the workaround by changing into the worktree directory before running cc without the -w flag, as it provides a reliable method to navigate to the correct worktree directory despite the issue with the -w flag.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix cc -w flag converts '/' to '+' in worktree path, fails to enter nested worktrees [1 comments, 2 participants]