git 我的 Visual Studio 解决方案资源管理器中前面的小红色减号图标是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32649585/
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
What does the small preceding red minus icon mean in my Visual Studio Solution Explorer?
提问by g.pickardou
Recently a preceding small red icon started to appear before some of my VS 2015 Solution Explorer. I definitely remember it was not there some days before.
最近在我的一些 VS 2015 解决方案资源管理器之前开始出现一个前面的小红色图标。我绝对记得几天前它不在那里。
I think it has something to do with git source control what I am using (not sure), but can not figure what is it.
我认为这与我正在使用的 git 源代码控制有关(不确定),但无法弄清楚它是什么。
* edit *
* 编辑 *
Added more diagnostics:
添加了更多诊断:
- The files can be opened by double click
- The tracking does not work for these files (I mean not activated in Solution Explorer when switching to the editor tab for that file)
- Editing and saving does not help
- Close/Reopen VS does not help
- Refresh does not help
- 文件可以双击打开
- 跟踪对这些文件不起作用(我的意思是在切换到该文件的编辑器选项卡时未在解决方案资源管理器中激活)
- 编辑和保存没有帮助
- 关闭/重新打开 VS 没有帮助
- 刷新没有帮助
* end edit *
* 结束编辑 *
回答by Lernkurve
According to the version control icon documentation, it indicates files that have been excluded from version control, for example in the .gitingore
file.
根据版本控制图标文档,它表示已从版本控制中排除的.gitingore
文件,例如在文件中。
However, in my case with Visual Studio Community 2015 Update 2, those icons also show up when I create a new project. Even if none of the created files are explicitly ignored through .gitignore
. The icons disappear once I've committed the changes.
但是,在我使用 Visual Studio Community 2015 Update 2 的情况下,当我创建新项目时也会显示这些图标。即使没有通过.gitignore
. 一旦我提交了更改,图标就会消失。
回答by Sam Rabeeh
When you create a visual studio project and select the "add to source control" option and you are using Git, Visual studio automatically generates a .gitignore file.
当您创建一个 Visual Studio 项目并选择“添加到源代码管理”选项并且您正在使用 Git 时,Visual Studio 会自动生成一个 .gitignore 文件。
The .gitignore file contains a large amount extensions and directories. For instance:
.gitignore 文件包含大量扩展名和目录。例如:
- User-Specific files such as *.suo, *.user etc.
- Build Results, DNS artifacts
- Profiler, Resharper, JustCode and TeamCity and many other add-ins artifacts
- SQL Server files *.mdf and *.ldf
- 特定于用户的文件,例如 *.suo、*.user 等。
- 构建结果、DNS 工件
- Profiler、Resharper、JustCode 和 TeamCity 以及许多其他插件工件
- SQL Server 文件 *.mdf 和 *.ldf
I think you get the idea, you can open the .gitignore and view it yourself.
我想你明白了,你可以打开 .gitignore 并自己查看。
You can right-click on the file that is being ignored and include it in your source if you wish.
如果您愿意,您可以右键单击被忽略的文件并将其包含在您的源中。
This is the behaviour in Visual Studio 2015. I haven't confirmed if this is the behaviour in previous Visual Studio editions.
这是 Visual Studio 2015 中的行为。我还没有确认这是否是以前的 Visual Studio 版本中的行为。
回答by Andre Batista
For those who are getting this on Visual Studio 2019, I found that clicking on "Add Ignored File File to Source Control" under Source Control solved this for me and finally added the files for commit on my Git repository:
对于那些在 Visual Studio 2019 上获得此信息的人,我发现单击源代码管理下的“将忽略的文件文件添加到源代码管理”为我解决了这个问题,并最终在我的 Git 存储库中添加了要提交的文件:
回答by Corb3nik
I think I managed to figure out what is going on here.
我想我设法弄清楚这里发生了什么。
The (-) symbols next to each of your files/projects represent files that are ignored by .gitignore
.
每个文件/项目旁边的 (-) 符号表示被.gitignore
.
From what I am seeing in your project, this would mean that you ignored the files in your .build
and .misc
folders.
从我在您的项目中看到的情况来看,这意味着您忽略了您的.build
和.misc
文件夹中的文件。
As for the (-) symbol next to your solution, I think this means that you have also ignored your .sln
in your .gitignore
file.
至于您的解决方案旁边的 (-) 符号,我认为这意味着您也忽略.sln
了您的.gitignore
文件。
Likewise, if you were to add the .csproj
files in your .gitignore
, I would expect a (-) symbol next to your projects like Sliders.Core.Test
.
同样,如果您要将.csproj
文件添加.gitignore
到您的Sliders.Core.Test
.
Hope this helps.
希望这可以帮助。