Git 当我保存带有更改的文件时,其状态自动恢复为未更改/已提交(蓝色锁)
当我在visual studio中修改文件(cs/txt)时,其在解决方案资源管理器中的图标将从蓝色锁定变为红色v,但一旦我保存该文件,图标将变回蓝色锁定,并且在团队资源管理器中不会有任何要提交的更改。此问题还影响解决方案本身的更改 什么可能导致这种行为 编辑:这是我的.gitignore文件的内容,我没有看到任何异常Git 当我保存带有更改的文件时,其状态自动恢复为未更改/已提交(蓝色锁),git,visual-studio-2013,Git,Visual Studio 2013,当我在visual studio中修改文件(cs/txt)时,其在解决方案资源管理器中的图标将从蓝色锁定变为红色v,但一旦我保存该文件,图标将变回蓝色锁定,并且在团队资源管理器中不会有任何要提交的更改。此问题还影响解决方案本身的更改 什么可能导致这种行为 编辑:这是我的.gitignore文件的内容,我没有看到任何异常 ## Ignore Visual Studio temporary files, build results, and ## files generated by popular
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*/App_Data/*.mdf
*/App_Data/*.ldf
#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
# =========================
# Windows detritus
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
也许这些是生成的文件,IDE中的一些自动生成器会一直覆盖它们 要弄清楚发生了什么,首先要减少问题空间:退出VS并使用命令行工具
.gitignore
以对Git隐藏它,它现在会更改吗我遇到了一个类似的问题:在保存时,VisualStudio将文件标记为已提交,但事实并非如此。“提交”按钮被禁用,即使我已经键入了一些提交注释
我这边的问题是.gitignore文件在我的系统中不存在。因此,在使用VS创建之后,团队资源管理器终于开始按预期工作。不确定这是否有帮助,但同样的事情发生在我身上。为了解决这个问题,我必须尝试两件事,我相信这两件事可能是导致它的原因,因为单独地说,它并没有解决它。奇怪的是,在我的解决方案中,只有三个项目中的一个发生了这种情况
希望这能有所帮助。可能该文件位于.gitignore。。。你所有的文件都有这个吗?我马上查一下,然后告诉你know@ChrisMaes我把.gitignore的内容放在这里,我用.cs、.txt进行了测试,但也会影响解决方案本身的更改(添加/删除文件)。我也有同样的问题:(我将测试这些东西,但我已经可以放弃这些文件被覆盖的假设,因为它发生在解决方案中的所有文件上,包括解决方案本身,没有任何东西会覆盖我的更改,因为它们仍然存在。Git不会显示被忽略的文件的状态。我不确定添加时会发生什么并提交一个.gitignore中提到的文件;但是您可以通过一个新的小型演示git repo轻松地尝试。因此,下一步是从命令行运行git,以尽可能多地从bug中提取代码行。