Feature Request: Allow Claude to manage git worktrees within project boundaries
🛠️ Feature Request: Support for Git Worktrees in Claude Code
📌 Summary
Claude Code currently enforces strict directory navigation limits for security, which prevents the use of git worktree workflows. This limits productivity for developers using parallel feature development strategies.
🔍 Current Behavior
When attempting to use git worktree, Claude throws the following error:
ERROR: cd to '../ProjectName-feature' was blocked. For security, Claude Code may only change directories to child directories of the original working directory (/path/to/project) for this session.
💡 Proposed Solution
Introduce a configuration option to allow safe navigation to sibling git worktree directories. For example:
.claude/config.json
{
"permissions": {
"allowGitWorktreeNavigation": true,
"worktreePattern": "../{projectName}-*"
}
}
Claude should:
- Detect valid git worktrees from
git worktree list - Permit
cdinto these verified directories - Allow switching between worktrees belonging to the same repo
✅ Use Case
# From within the main project dir
git worktree add ../MyProject-feature1 -b feature/feature1
git worktree add ../MyProject-feature2 -b feature/feature2
Claude should support:
- Creating new worktrees
- Navigating between them
- Performing operations like edits, commits, and codegen in each
🚀 Benefits
- Parallel Feature Dev: Work across multiple features at once
- Isolated Environments: Separate
node_modules, venvs, etc. - Clean Git Histories: Feature branches are neatly organized
- Deeper Claude Integration: Claude could manage the full worktree lifecycle
🔐 Security Considerations
- Allow only verified
git worktreedirs (viagit worktree list) - Require explicit opt-in via
.claude/config.json - Limit access to sibling directories matching a defined pattern
🔁 Alternative Solutions
If directory navigation can't be loosened:
- Provide a
claude worktreecommand to spawn new sessions in worktrees - Add internal commands to create/switch/manage worktrees
- Introduce a higher-level project workspace model that groups worktrees
📎 Related
- #1052 – Field Notes: Git Worktree Pattern
🙏 Final Note
Supporting git worktree would meaningfully boost Claude Code’s developer experience and flexibility—without compromising security when opt-in restrictions are applied.
This would be nice, but as a workaround, I've been starting CC from the parent directory of the worktrees to allow me to work on multiple worktrees.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Permissions propagation would be great too
thanks for reporting! we're looking into it