claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[FEATURE] CLI support for .worktreeinclude file (parity with desktop app)

Open saoudrizwan opened this issue 4 months ago • 1 comments

Problem Statement

The Claude Code desktop app documents and supports .worktreeinclude files—when creating worktrees through the GUI, it automatically copies files matching the patterns in .worktreeinclude to the new worktree.

However, the CLI has no awareness of .worktreeinclude. When using Claude Code CLI to create git worktrees, users have to manually instruct Claude to copy these files, or create custom slash commands to handle it (which is what I've done as a workaround).

This is a gap in feature parity between the desktop and CLI experiences.

Proposed Solution

When Claude Code CLI detects a .worktreeinclude file in the repository root, it should automatically add context/instructions so that when Claude creates worktrees, it copies files matching those patterns to the new worktree (preserving directory structure).

This could be implemented as:

  1. Detecting .worktreeinclude at repo root during session init
  2. Adding a system instruction like: "When creating git worktrees, copy files matching patterns in .worktreeinclude to the new worktree, preserving directory structure"

Alternative Solutions

Currently I work around this with a custom slash command that:

  1. Creates the worktree
  2. Reads .worktreeinclude patterns
  3. Copies matching files to the new worktree

This works but shouldn't be necessary since the desktop app already supports this natively.

Use Case Example

  1. I have a monorepo with local environment files, IDE settings, and config that aren't committed
  2. .worktreeinclude contains patterns like .env.local, .vscode/, CLAUDE.local.md
  3. When I ask Claude to create a worktree for parallel work, I expect these files to come along
  4. With desktop app: works automatically
  5. With CLI: need to manually tell Claude to copy them or use a custom command

saoudrizwan avatar Dec 25 '25 05:12 saoudrizwan

Is there any update related to this, or any proposed workaround at the moment?

iraklisg avatar Jan 13 '26 13:01 iraklisg