git 我应该将 Visual Studio 2015 .vs 文件夹添加到源代码管理吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31878901/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Should I add the Visual Studio 2015 .vs folder to source control?
提问by SoftwareFactor
Visual Studio 2015 creates a new folder called ".vs". What is the purpose of it and should I add it to source control?
Visual Studio 2015 会创建一个名为“.vs”的新文件夹。它的目的是什么,我应该将它添加到源代码管理中吗?
回答by Patrick Quirk
No, you should not add it to source control. The purpose of this folder is to move machine- and user-specific files to a central location. The explanation on the Visual Studio User Voice issueexplains it well:
不,您不应将其添加到源代码管理中。此文件夹的目的是将特定于机器和用户的文件移动到中央位置。在解释Visual Studio用户语音问题解释说得好:
So far, we have moved the .SUO file and the VB/C# compiler IntelliSense database files to the new location. All new project specific, machine local files will be added to the new location too. We plan on taking this even further in future releases and are investigating how to improve the directory structure of build output and other existing files that can clutter the source tree.
到目前为止,我们已将 .SUO 文件和 VB/C# 编译器 IntelliSense 数据库文件移动到新位置。所有新项目特定的机器本地文件也将添加到新位置。我们计划在未来的版本中更进一步,并正在研究如何改进构建输出和其他可能使源代码树混乱的现有文件的目录结构。
These are all files that you would never check in, since they are generated from a build or contain machine-specific information.
这些都是您永远不会签入的文件,因为它们是从构建生成的或包含特定于机器的信息。
回答by crea1
Github provides alot of .gitignore templates. In their template for visual studio they have ignored the .vs folder. Snippet from the template on github.
Github 提供了很多 .gitignore 模板。在他们的 Visual Studio 模板中,他们忽略了 .vs 文件夹。来自github 模板的片段。
# Visual Studio 2015 cache/options directory
.vs/
回答by Jim Wolff
As described in the quote taken from uservoice in Patrick's answer, the folder is not intended for source control.
正如帕特里克回答中引用自 uservoice 的引述所述,该文件夹不适用于源代码控制。
Howeverlike comments also point out, there can be some cases where you would want to include specific files from the folder.
然而,就像评论也指出的那样,在某些情况下,您可能希望包含文件夹中的特定文件。
I would add this to .gitignore:
我会将此添加到 .gitignore:
.vs/
And then use whatever git tool you prefer to add certain files like a shared configuration of the applicationhost.config if needed.
然后使用您喜欢的任何 git 工具添加某些文件,例如 applicationhost.config 的共享配置(如果需要)。
Or use a git command like this:
或者使用这样的 git 命令:
git add -f .vs/config/applicationhost.config
This way git adds the file, even if it is ignored.
这样 git 添加文件,即使它被忽略。