简体   繁体   中英

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. I can continue to work for about 30mins-1hr and all of the changes show up(any file I make changes).

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.

I am working with a multi-tier MVC application so lots of C#, bunch of.cshtml and so on.

Tips? Google doesnt find anything. Here is the.gitignore file... I got the same issue as this dude...and he got no answer!

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

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

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.

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

  1. Find your .git folder for your repository.
  2. Locate and delete the 'index.lock' file inside.
  3. Restart Visual Studio.

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

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.

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

For me rebooting was not necessary. Simply closing and reopening the Solution works. Whenever that trick doesn't work, restarting Visual Studio works.

Unlike Eclipse IDE, Visual Studio doesn't provide a Restart menu item. 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. 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. 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 扩展,请重新安装并重新启动 Visual Studio 2015,它解决了我的问题。

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.

By default Visual Studio stores "C:\Users\UserName\Source\Repos" as the "Default Location" of Git files. Once we change the "Default Location" to root folder of our Git projects and restart Visual Studio, it works.

Visual Studio >> Tools >> Options >> Source Control >> Git Global Settings >> Update the "Default Location" with right path of Git Project.

After making the change, make sure to restart Visual Studio.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM