--worktree (-w) flag silently fails to create git worktree
Resolved 💬 3 comments Opened Apr 1, 2026 by zime78 Closed May 22, 2026
Bug Description
When launching Claude Code with the --worktree (-w) flag, the session starts normally but no git worktree is created. There is no error message or warning — it silently fails and runs in the main working directory.
Steps to Reproduce
- Navigate to a git repository
- Run:
claude --dangerously-skip-permissions -w setting - Session starts normally (hooks fire, conversation begins)
- Run
git worktree listinside the session
Expected Behavior
- A new git worktree named
settingshould be created - The session should run inside the worktree directory
- A new branch (e.g.,
settingorworktree/setting) should be checked out
Actual Behavior
- Session starts in the main working directory (not a worktree)
git worktree listshows only the main directory — no additional worktrees.git/worktrees/directory does not exist- No error message or warning is displayed
- No branch related to "setting" is created
$ git worktree list
/path/to/repo e53765b5 [feature/zime/dev]
Environment
- Claude Code version: 2.1.89
- OS: macOS (Darwin 25.4.0)
- Shell: zsh
- Platform: darwin (Apple Silicon)
- Git version: available and working (repo is clean, no uncommitted changes)
Additional Context
- The repository has a clean working tree (no uncommitted changes)
- The current branch is a feature branch (
feature/zime/dev) - The
--helpoutput confirms the flag exists:-w, --worktree [name] Create a new git worktree for this session (optionally specify a name) - Other flags in the same command (
--dangerously-skip-permissions) work correctly
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗