28

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
Community
  • 1
  • 1
Spets
  • 2,391
  • 4
  • 24
  • 26

10 Answers10

21

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.

Community
  • 1
  • 1
Chris Smowton
  • 2,410
  • 2
  • 17
  • 15
  • 1
    In my case it was a .jfm file in a sql project – wecky Jun 28 '18 at 09:52
  • If I closed the offending project/solution while keeping VisualStudio open, the changes did all of a sudden show up. Solved it by adding *.jfm to .gitignore and committing the changes while the project file was not loaded. – wecky Jun 28 '18 at 10:09
19

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.

Andrew Lundgren
  • 1,134
  • 1
  • 12
  • 18
  • 4
    Same issue and I rebooted and changes appeared. Up until now I have not seen this before and hopefully will not again. – Steve Feb 13 '15 at 23:37
  • Visual Studio 2019....nothing in this thread works or applies, including reboot. Before I restarted my machine some files were showing the line-by-line changes in the gutter. Now none of them show changes. If I go to a terminal I can clearly see the changes with git status. All are modified local files on the main branch. The other VS git tools, including the filter in Solution Explorer, show the modified files. – Sean Anderson Mar 22 '22 at 14:39
  • 1
    Rebooting fixed it for me in VS2022 17.0.3. Thanks! – Onkel-j Nov 29 '22 at 18:41
16

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!

susieloo_
  • 1,391
  • 1
  • 16
  • 22
  • Please don't post identical answers to multiple questions. Post one good answer, then vote/flag to close the other questions as duplicates. If the question is not a duplicate, *tailor your answers to the question.* – Paul Roub Jul 17 '17 at 20:37
  • @PaulRoub Thanks for the tip! How do you close other questions as duplicates? – susieloo_ Jul 17 '17 at 20:45
  • 1
    Use the "Flag" link right below the question. See [How should duplicate questions be handled?](https://meta.stackexchange.com/questions/10841/how-should-duplicate-questions-be-handled/) and [Where on earth is the “mark duplicate” UI?](https://meta.stackexchange.com/questions/118124/where-on-earth-is-the-mark-duplicate-ui) – Paul Roub Jul 17 '17 at 20:50
  • This works for me, vs2019 has the same issue. I deleted the 'index.lock' file and restart vs2019, then I can see files changes. Thanks – Bes Ley May 28 '21 at 01:40
8

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.

Wolf5
  • 16,600
  • 12
  • 59
  • 58
5

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.

Prakash G. R.
  • 4,746
  • 1
  • 24
  • 35
1

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.

Ken
  • 1,110
  • 2
  • 10
  • 26
1

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

Pooja Sinha
  • 89
  • 1
  • 5
1

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.

enter image description here

gmsi
  • 1,062
  • 1
  • 16
  • 29
0

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

Zahid Khan
  • 16
  • 2
0

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.

Miroslav Adamec
  • 1,060
  • 1
  • 15
  • 23