Per-worktree local exclusion

人盡茶涼 提交于 2019-12-06 05:47:46

问题


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.


回答1:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!