claude -w (--worktree) silently fails in git submodules
Resolved 💬 2 comments Opened Feb 20, 2026 by gsim-inbolt Closed Feb 20, 2026
Description
Running claude -w from inside a git submodule silently fails to create a worktree. No error is shown — Claude just starts a normal session in the main working tree as if -w was never passed.
Steps to reproduce
- Have a repo with a git submodule
cdinto the submodule directory- Run
claude -worclaude -w some-name - Observe that no worktree is created under
.claude/worktrees/ - Claude starts in the main working tree on the current branch
Expected behavior
Either:
- The worktree is created successfully inside the submodule, or
- Claude displays a clear error/warning explaining that
--worktreeis not supported in git submodules
Actual behavior
No worktree is created, no error is shown. The session starts normally in the main working tree, making it appear as if the -w flag was ignored.
Environment details
- The submodule's
.gitis a file pointing to the parent repo's.git/modules/<path>directory (standard git submodule setup) git rev-parse --git-dirreturns a path like/parent-repo/.git/modules/packages/submodule-name- Manually running
git worktree addinside the submodule works fine
Versions
- Claude Code: latest (installed via npm)
- Git: standard
- OS: Linux (Ubuntu)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗