[Bug] Claude Code resets working directory from git worktree to main repository
Resolved 💬 2 comments Opened Jan 22, 2026 by trobanga Closed Jan 23, 2026
Bug Description
Summary
Claude Code unexpectedly resets the working directory from a git worktree to the main repository directory between conversation turns, requiring users to manually correct the context.
Steps to Reproduce
- Have a git repository with worktrees (e.g., .worktrees/42-issue)
- Start Claude Code session in the main repository
- Tell Claude to switch the working dir
- Create and accept a plan
Expected Behavior
Claude Code should maintain awareness of which worktree the user is working in and continue operating on files in that worktree.
Actual Behavior
Claude Code reads from the main repo instead of the worktree.
Environment
- Platform: Linux 6.12.64-1-MANJARO
- Model: claude-opus-4-5-20251101
- Git worktrees: Multiple active worktrees
Impact
- Confusion when file contents don't match expectations
- Risk of editing wrong files in wrong branches
- Wasted time correcting Claude's contex
Environment Info
- Platform: linux
- Terminal: alacritty
- Version: 2.1.15
- Feedback ID: 4db6ec73-543a-4aa0-9bce-3ec166ceda7b
Errors
[]This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗