Visual Studio:Git Team Explorer 未显示任何更改

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26053552/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 10:26:09  来源:igfitidea点击:

Visual Studio: Git Team Explorer does not show any changes

c#gitvisual-studio

提问by Spets

When I first add a project to source control(GIT) it will show all of the files and everything will be peachy. I can continue to work for about 30mins-1hr and all of the changes show up(any file I make changes).

当我第一次将项目添加到源代码管理 (GIT) 时,它会显示所有文件,并且一切都会很好。我可以继续工作大约 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

采纳答案by Andrew Lundgren

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 是不够的,但在重新启动整个系统后,更改现在显示在团队资源管理器中。

回答by Chris Smowton

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

See also Visual Studio TFS Git not seeing any changesfor more potential causes.

另请参阅Visual Studio TFS Git 没有看到更多潜在原因的任何更改

回答by Wolf5

My Visual Studio "Source Control - Git" log kept complaining about a locked file from my SQL project. A .jfm file. Added it to .gitignore and then stuff worked.

我的 Visual Studio“源代码控制 - Git”日志一直抱怨我的 SQL 项目中的文件被锁定。.jfm 文件。将它添加到 .gitignore 然后东西就起作用了。

So check your Git log when your solution shows no changes no matter what you change.

因此,无论您更改什么,当您的解决方案都没有显示任何更改时,请检查您的 Git 日志。

回答by susieloo_

Unfortunately, none of the above worked for me, but after some time, this was my solution:

不幸的是,以上都不适合我,但过了一段时间,这是我的解决方案:

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

I am using Visual Studio 2017, but I hope this helps someone!

我正在使用 Visual Studio 2017,但我希望这对某人有所帮助!

回答by Prakash G. R.

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. I need to install an Extensionto do this.

与 Eclipse IDE 不同,Visual Studio 不提供重新启动菜单项。我需要安装一个扩展来做到这一点。

回答by Ken

For what it's worth, I didn't have to reboot VS2015 or my machine to get my changes to appear. I simply disconnected from the source control, and reconnected, and it saw the changes then.

对于它的价值,我不必重新启动 VS2015 或我的机器来显示我的更改。我只是从源代码控制断开连接,然后重新连接,然后它就看到了变化。

回答by Pooja Sinha

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. 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

在我的场景中,我正在处理我的本地项目,同时我在不同的目录中克隆了该项目。当我试图在我当前的工作项目中进行克隆时,它以某种方式连接到其他文件夹。我为我当前的项目打开了 git bash,可以看到,分支没有关联。当我打开克隆项目时,我可以看到关联的分支。所以在 VS 中,我打开了克隆的 repo 并添加了我的项目,我能够在 Team Explorer,Changes 中看到我的更改

回答by Miroslav Adamec

Make sure your files are not encrypted. I was using Windows workfolders and new files are encrypted. Git in VS is unable to see them.

确保您的文件未加密。我使用的是 Windows 工作文件夹,新文件被加密。VS 中的 Git 无法看到它们。

回答by Zahid Khan

If you're using Git Extensions, Reinstall and restart your Visual Studio 2015, it solved my problem.

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