feat: add wt.symlink config and --symlink flag#164
Merged
k1LoW merged 1 commit intok1LoW:mainfrom Mar 28, 2026
Merged
Conversation
Add support for symlinking directories instead of copying when creating new worktrees. This is useful for large directories like node_modules where sharing the same files across worktrees is acceptable and much faster than copying. Symlink patterns use gitignore syntax and match top-level directories. Matching directories are symlinked to the source worktree, so changes in the source are immediately visible in all worktrees that symlink it. Usage: git config --add wt.symlink "node_modules/" git wt my-branch --symlink "node_modules/" Non-matching directories are still copied normally. Files at the root level are never symlinked, only directories.
Owner
|
@ryoppippi GREAT!! Thank you!! |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wt.symlinkgit config and--symlinkCLI flag for symlinking directories instead of copyingUse case
Large directories like
node_modules(5.9GB+, 265K+ files) take ~21s even withclonefile. Symlinking is instantaneous:git config --add wt.symlink "node_modules/"Trade-off: symlinked directories are shared —
npm installin one worktree affects all others. Use this when the directory is read-only or rebuilt by hooks.Test plan
TestCopyFilesToWorktree_Symlink— verifies symlink is created, target is correct, files accessible through symlink, non-symlink files copied normallyTestCopyFilesToWorktree_Symlink_NonMatchingDir— verifies only matching directories are symlinked, others are copied