Skip to content

[ENHANCEMENT] Utilize hard links for file copies when processing .worktreeinclude #11758

@draxxris

Description

@draxxris

Problem (one or two sentences)

When using .worktreeinclude to copy gitignored directories (such as node_modules or build artifacts) to a new worktree, Roo Code performs a full file copy of the entire directory. For large directories that can span many gigabytes, this results in:

  • Slow worktree creation - copying gigabytes of data takes considerable time
  • Excessive disk usage - each worktree duplicates the same files, multiplying storage consumption
  • Unnecessary I/O wear - full copies stress storage devices unnecessarily

Context (who is affected and when)

This affects any developer who:

  • Works with large gitignored directories (e.g., node_modules, .venv, build outputs, cache directories)
  • Uses the worktree feature to parallelize work across multiple branches
  • Has limited disk space or slow storage (HDDs, network drives)
  • Frequently creates and destroys worktrees as part of their workflow
  • The impact is most noticeable when the .worktreeinclude patterns match directories containing thousands of files or multiple gigabytes of data. A typical node_modules directory in a large project can easily exceed 1-2 GB with tens of thousands of files.

Desired behavior (conceptual, not technical)

When copying files matching .worktreeinclude patterns to a new worktree, the system should use hard links instead of full copies when the filesystem supports them. Hard links create additional directory entries pointing to the same underlying data.

A checkbox could be added to the worktree GUI to make hard links optional, if necessary.

Constraints / preferences (optional)

No response

Request checklist

  • I've searched existing Issues and Discussions for duplicates
  • This describes a specific problem with clear context and impact

Roo Code Task Links (optional)

No response

Acceptance criteria (optional)

No response

Proposed approach (optional)

No response

Trade-offs / risks (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions