简体   繁体   English

Visual Studio:Git 团队资源管理器未显示任何更改

[英]Visual Studio: Git Team Explorer does not show any changes

When I first add a project to source control(GIT) it will show all of the files and everything will be peachy.当我第一次将项目添加到源代码控制 (GIT) 时,它会显示所有文件,并且一切都会很好。 I can continue to work for about 30mins-1hr and all of the changes show up(any file I make changes).我可以继续工作大约 30 分钟到 1 小时,所有更改都会显示出来(我所做的任何文件更改)。

But after some period of time, it shows that no file is edited no matter how many changes I make.但是一段时间后,无论我进行多少更改,它都显示没有文件被编辑。 I just dont get it...I looked at the.gitignore file and I dont see any of the file types I'm working with so I don't get what the heck is going on.我只是不明白...我查看了 .gitignore 文件,但没有看到我正在使用的任何文件类型,所以我不明白到底发生了什么。

I am working with a multi-tier MVC application so lots of C#, bunch of.cshtml and so on.我正在使用一个多层 MVC 应用程序,所以有很多 C#、一堆.cshtml 等等。

Tips?提示? Google doesnt find anything.谷歌没有找到任何东西。 Here is the.gitignore file... I got the same issue as this dude...and he got no answer!这是 .gitignore 文件...我和这个家伙遇到了同样的问题...他没有答案!

When I save a file with changes, its status automatically goes back to unchanged/committed (blue lock) 当我保存带有更改的文件时,其状态会自动恢复为未更改/已提交(蓝色锁定)

## 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
vsql/
*.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

I found VS was holding an .opendb file open, causing a permissions clash when searching for changes.我发现 VS 正在打开一个 .opendb 文件,导致在搜索更改时发生权限冲突。 It reported the precise file that was causing the trouble in the Output window, under "Source Control - Git".它在“源代码控制 - Git”下的“输出”窗口中报告了导致问题的确切文件。 Adding this to my .gitignore fixed the issue.将此添加到我的 .gitignore 解决了该问题。 If a VS restart or a reboot fixes the issue then you're probably closing the offending file handle -- in my case VS opened the problem file every time.如果 VS 重新启动或重新启动解决了问题,那么您可能正在关闭有问题的文件句柄——在我的情况下,VS 每次都打开问题文件。

See also Visual Studio TFS Git not seeing any changes for more potential causes.另请参阅Visual Studio TFS Git 没有看到更多潜在原因的任何更改

Rebooting my machine fixed it for me.重新启动我的机器为我修复了它。 Rebooting Visual Studio wasn't enough, but after rebooting the entire system the changes are now shown in Team Explorer.重新启动 Visual Studio 是不够的,但在重新启动整个系统后,更改现在显示在团队资源管理器中。

Unfortunately, none of the above worked for me, but after some time, this was my solution:不幸的是,以上都不适合我,但过了一段时间,这是我的解决方案:

  1. Find your .git folder for your repository.找到您的存储库的.git文件夹。
  2. Locate and delete the 'index.lock' file inside.找到并删除里面的'index.lock'文件。
  3. Restart Visual Studio.重新启动 Visual Studio。

I am using Visual Studio 2017, but I hope this helps someone!我正在使用 Visual Studio 2017,但我希望这对某人有所帮助!

My Visual Studio "Source Control - Git" log kept complaining about a locked file from my SQL project.我的 Visual Studio“源代码控制 - Git”日志一直抱怨我的 SQL 项目中的锁定文件。 A .jfm file. .jfm 文件。 Added it to .gitignore and then stuff worked.将它添加到 .gitignore 然后东西就起作用了。

So check your Git log when your solution shows no changes no matter what you change.因此,无论您进行什么更改,当您的解决方案都没有显示任何更改时,请检查您的 Git 日志。

For me rebooting was not necessary.对我来说重新启动是没有必要的。 Simply closing and reopening the Solution works.只需关闭并重新打开解决方案即可。 Whenever that trick doesn't work, restarting Visual Studio works.每当该技巧不起作用时,重新启动 Visual Studio 即可。

Unlike Eclipse IDE, Visual Studio doesn't provide a Restart menu item.与 Eclipse IDE 不同,Visual Studio 不提供重新启动菜单项。 I need to install an Extension to do this.我需要安装一个扩展来做到这一点。

For what it's worth, I didn't have to reboot VS2015 or my machine to get my changes to appear.对于它的价值,我不必重新启动 VS2015 或我的机器来显示我的更改。 I simply disconnected from the source control, and reconnected, and it saw the changes then.我只是从源代码控制断开连接,然后重新连接,然后它就看到了变化。

In my scenario, I was working on my local project and simultaneously I have cloned the project in different directory.在我的场景中,我正在处理我的本地项目,同时我在不同的目录中克隆了该项目。 When I was trying to clone in my current working project, it was somehow connecting to other folder.当我尝试在当前工作项目中进行克隆时,它以某种方式连接到其他文件夹。 I opened git bash for my current project and could see, branch is not associated.我为我当前的项目打开了 git bash,可以看到,分支没有关联。 When I opened cloned project, i could see the branch associated.当我打开克隆项目时,我可以看到关联的分支。 So in VS, I opened the cloned repo and added my project, I was able to see my changes in Team Explorer, Changes所以在 VS 中,我打开了克隆的 repo 并添加了我的项目,我能够在 Team Explorer,Changes 中看到我的更改

如果您使用的是 Git 扩展,请重新安装并重新启动 Visual Studio 2015,它解决了我的问题。

Make sure your files are not encrypted.确保您的文件未加密。 I was using Windows workfolders and new files are encrypted.我使用的是 Windows 工作文件夹,新文件被加密。 Git in VS is unable to see them. VS 中的 Git 无法看到它们。

By default Visual Studio stores "C:\Users\UserName\Source\Repos" as the "Default Location" of Git files.默认情况下,Visual Studio 将"C:\Users\UserName\Source\Repos"存储为 Git 文件的"Default Location" Once we change the "Default Location" to root folder of our Git projects and restart Visual Studio, it works.一旦我们将“默认位置”更改为 Git 项目的根文件夹并重新启动 Visual Studio,它就可以工作了。

Visual Studio >> Tools >> Options >> Source Control >> Git Global Settings >> Update the "Default Location" with right path of Git Project. Visual Studio >> 工具 >> 选项 >> 源代码管理 >> Git 全局设置 >> 使用 Git 项目的正确路径更新“默认位置”。

After making the change, make sure to restart Visual Studio.进行更改后,请确保重新启动 Visual Studio。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的Visual Studio在解决方案资源管理器中不显示解决方案? - Why does my Visual Studio not show a solution in the Solution Explorer? 链接到TFS-Git的Visual Studio 2013中的C#DLL项目的团队资源管理器中未出现构建节点 - Build Node doesn't appear in Team Explorer for a C# DLL project in Visual Studio 2013 linked to TFS-Git 向Visual Studio 2015s团队资源管理器添加新部分 - Adding new sections to Visual studio 2015s team explorer 在Visual Studio 2012中显示未构建的更改 - Show unbuilt changes in Visual Studio 2012 Visual Studio 2019 Git 拉动和同步图标未在 Git 更改中显示 - Visual studio 2019 Git Pull and Sync icon is not Showing in Git changes GIT 集成以在 Visual Studio 中显示方法历史记录 - GIT integration to show method history in Visual Studio 是否有可能使用团队资源管理器进行版本控制而无需为Visual Studio购买许可证? - is it possible to use team explorer for version control without buying license for visual studio? 如何从Visual Studio外部打开WorkItem(VS-Team Explorer)? - How to open WorkItem (VS-Team Explorer) from outside visual studio? 只要表单发生任何更改,Visual Studio就会更改控件属性 - Visual Studio changes control property whenever there any changes in form Visual Studio 服务器资源管理器显示表数据为空白 - Visual Studio Server Explorer show table data is blank
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM