Skip to content

[FEATURE] Option to disable automatic git worktree creation for linked repositories #21236

Description

@dotanxmpie

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

When selecting a repository from the Project Picker that is linked to a local folder, Claude Code automatically creates a git worktree (e.g., C:\Users\<user>\.claude-worktrees\<repo>\<branch-name>) instead of working directly in the selected local path. Users have no option to disable this behavior.

This causes confusion when users expect files to be created/modified in their actual project folder (e.g., C:\code\my-project) but instead find them in a hidden worktree location. It also adds friction for users who don't need branch isolation and simply want to work directly in their repository.

Proposed Solution

Add a setting (either global or per-project) to disable automatic worktree creation. When disabled, Claude Code should work directly in the local folder path shown in the Project Picker dropdown, without creating a separate worktree.

Possible implementations:

  1. A toggle in Settings: "Use git worktrees for branch isolation" (default: on)
  2. A per-session option when selecting a project: "Open in worktree" vs "Open directly"
  3. A .claude/settings.json option: "useWorktrees": false

Alternative Solutions

  1. Keep worktrees but make the behavior more transparent - show the actual working directory prominently in the UI so users know where files will be created
  2. Add a "Copy to original repo" command that syncs worktree changes back to the main repository location
  3. Use "Choose a different folder" as a workaround (current state), but this loses the GitHub integration benefits

Priority

Medium - Would be very helpful

Feature Category

Configuration and settings

Use Case Example

  1. User has a local repository at C:\code\my-project linked to github.com/user/my-project
  2. User selects "user/my-project" from the Project Picker (which shows C:\code\my-project as the local path)
  3. User asks Claude to create a new feature
  4. Expected: Files created in C:\code\my-project
  5. Actual: Files created in C:\Users\<user>\.claude-worktrees\my-project\random-branch-name
  6. User is confused when they can't find the files in their IDE or when git status in their original folder shows no changes

Additional Context

  • Platform: Windows 11
  • The worktree path format observed: C:\Users\<user>\.claude-worktrees\my-project\fervent-chatterjee
  • Worktrees are useful for some workflows, but should be opt-in rather than forced behavior for users who prefer direct repository access

Issue #12513 is closest to this feature request, but there it's considered as a bug, whereas here I'm raising a feature request to enhance the product.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions