Feature Request: add exclude options on `wt step copy-ignored`
Would it be possible to have some sort of --exclude option to wt step copy-ignored. I really like most of what wt step copy-ignored is doing as a post-start step but I was looking to have something like: copy everything from .gitignore except directory-X
I wasn't partial to .worktreeinclude as I really don't want to manage another file in each repo and really just wanted an exclude option.
Any other options?
Thanks for the suggestion! I searched the codebase and there's no --exclude CLI option today. The only filtering mechanism is the .worktreeinclude file.
One workaround that might help: .worktreeinclude uses gitignore-style patterns including negation, so you can get "copy everything except directory-X" with:
# .worktreeinclude
*
!directory-X/
This avoids listing every directory you do want — just a wildcard plus exclusions. It's not as ergonomic as a CLI flag, but it works today without any changes.
That said, I understand preferring a CLI --exclude flag over managing an extra file. I'll leave it for a maintainer to evaluate and prioritize.
does .worktreeinclude suffice?
Question about how .worktreeinclude works - does it ONLY include what you put in the list? (out of what is in .gitignore)?
By default (no .worktreeinclude file), wt step copy-ignored copies all gitignored files to the new worktree.
When .worktreeinclude exists, it acts as a whitelist filter on that set — only gitignored files that also match a pattern in .worktreeinclude get copied. So yes, it only includes what you list (out of what's in .gitignore).
To get "everything except directory-X", you'd use:
*
!directory-X/
The * matches all gitignored files, and !directory-X/ negates (excludes) that directory. It uses standard gitignore pattern syntax.
The new [step.copy-ignored] add in #1667 works for me.
Thanks