[BUG] --worktree flag replaces "/" with "+" in git branch names

Resolved 💬 3 comments Opened Apr 2, 2026 by DIO0550 Closed May 28, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When using claude -w feature/auth, the "/" in the worktree name is replaced with "+" in the branch name, resulting in worktree-feature+auth.

Previously, "/" was preserved in the branch name (e.g., feature/auth). This changed after the fix for "--worktree hanging silently when the worktree name contained a forward slash".

The "/" → "+" replacement is necessary for the worktree directory name (filesystem constraint), but Git branch names natively support "/" (e.g., feature/auth, bugfix/login). The sanitization should only apply to the directory name, not the branch name.

What Should Happen?

claude -w feature/auth should create a branch with "/" preserved:

  • Directory: .claude/worktrees/feature+auth/ (sanitized for filesystem — OK)
  • Branch: worktree-feature/auth (Git allows "/" in branch names)

The sanitization should only apply to the directory name, not the branch name.

Error Messages/Logs

Steps to Reproduce

  1. Run claude -w feature/auth
  2. Check the branch name: git branch --show-current
  3. Observe: branch is worktree-feature+auth instead of worktree-feature/auth

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.90 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

This breaks team branch naming conventions that use "/" as hierarchy separators (e.g., feature/*, bugfix/*, hotfix/*). The current workaround requires a full WorktreeCreate hook replacement just to fix the branch name.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗