如何让 git 忽略根级 .vs 目录?

How can I have git ignore the root level .vs directory?

我知道 git(自 1.8.2 起)将使用 .gitignore 文件(在根目录中)忽略任何级别的整个目录(例如 "bin") ) 包含如下内容:

bin/

但是,这似乎不适用于:

.vs/

以“.”开头的目录是否有特殊语法?

Is there special syntax for directories that begin with "."?

我确认没有什么特别的。

如果 git ls-files -- .vs/a_file_name returns 任何东西(见“How to tell if a file is git tracked (by shell exit code)?”),那么你需要,如你所见,先删除它:

git rm --cached -r -- .vs/

那么 git status 不应该从 .vs/

带来任何东西