feat(worktrees): support .worktreeinclude for copying gitignored files#128
Merged
pol-rivero merged 2 commits intopol-rivero:mainfrom Apr 9, 2026
Merged
Conversation
When creating a new worktree, automatically copy gitignored files listed in a .worktreeinclude file (gitignore syntax) from the main worktree into the new worktree. Only files that are both gitignored and matched by a pattern are copied — tracked files are never duplicated. - Add `addWorktreeWithIncludes()` which wraps `addWorktree()` with a best-effort post-creation copy step - Add `readWorktreeIncludePatterns()` to parse the .worktreeinclude file - Add `getIgnoredFilesMatchingPatterns()` using `git ls-files --others --ignored` and the `ignore` npm package for .gitignore-spec matching - Add `copyWorktreeIncludeFiles()` with path-traversal protection - Wire AddWorktreeDialog to use `addWorktreeWithIncludes` - Add `ignore` ^7.0.5 as a dependency - Add 11 unit tests covering all new functions Resolves pol-rivero#126
18bba03 to
3856e14
Compare
Owner
|
Just tested it and it works like a charm. Thanks! :) |
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.
Closes #126
Description
When creating a new worktree, automatically copy gitignored files listed in a .worktreeinclude file (gitignore syntax) from the main worktree into the new worktree. Only files that are both gitignored and matched by a pattern are copied — tracked files are never duplicated.
addWorktreeWithIncludes()which wrapsaddWorktree()with a best-effort post-creation copy stepreadWorktreeIncludePatterns()to parse the .worktreeinclude filegetIgnoredFilesMatchingPatterns()usinggit ls-files --others --ignoredand theignorenpm package for .gitignore-spec matchingcopyWorktreeIncludeFiles()with path-traversal protectionaddWorktreeWithIncludesignore^7.0.5 as a dependencyScreenshots
Release notes
Notes: