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

  1. Have a repo with a git submodule
  2. cd into the submodule directory
  3. Run claude -w or claude -w some-name
  4. Observe that no worktree is created under .claude/worktrees/
  5. 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 --worktree is 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 .git is a file pointing to the parent repo's .git/modules/<path> directory (standard git submodule setup)
  • git rev-parse --git-dir returns a path like /parent-repo/.git/modules/packages/submodule-name
  • Manually running git worktree add inside the submodule works fine

Versions

  • Claude Code: latest (installed via npm)
  • Git: standard
  • OS: Linux (Ubuntu)

View original on GitHub ↗

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