I'd like to use local file exclusion on a worktree. I tried adding the file name to .git/worktrees/$worktreename/info/exclude
but it doesn't take. The analogous file .git/info/exclude
works, but applies to all worktrees, not just the main one.
but it doesn't take
From this thread, it should, but if you are working with Visual Studio, it does not. Make sure to try with the latest 2.16.x version of Git to see if the issue persists.
Note that I do not see an info/exclude
in .git/worktrees
official layout documentation.
A workaround would to have a branch-specific .gitignore
content.
That means adding your untracked file to the worktree .gitignore
remains the best option.
And you can ignore modification on that (tracked) .gitignore
file with the update-index command seen here.
git update-index --assume-unchanged -- .gitignore
That allows you for the local exclusion you are after.
来源:https://stackoverflow.com/questions/48779515/per-worktree-local-exclusion