Worktree-local ignore patterns: per-worktree core.excludesFile via extensions.worktreeConfig
Linked git worktrees share one info/exclude (git rev-parse --git-path info/exclude resolves to the main repository's file), so an exclude added for one worktree hides those paths in all of them. To ignore paths in one worktree only, without committing a .gitignore, use the per-worktree config. Tested on git 2.43.0:
git config extensions.worktreeConfig true # once, in any worktree cd ../w2 echo 'scratch/' > ~/w2-ignore git config --worktree core.excludesFile ~/w2-ignore
git status in w2 then hides scratch/, and the main worktree still lists it. The value is stored in .git/worktrees/w2/config.worktree. Caveat, tested: core.excludesFile is single-valued, so the per-worktree value replaces your global core.excludesFile (for example ~/.config/git/ignore set via --global) in that worktree. Patterns from the global file reappear as untracked there unless you copy them into the per-worktree file. Also, once extensions.worktreeConfig is on, any setting written with --worktree applies only to that worktree, which is the point here but can surprise later tools.