Visual Studio 2017 15.3.0 git changes include "storage.ide" even though .vs/ in .gitignore
Asked Answered
U

5

37

I upgraded VS 2017 to 15.3.0 a few days ago. Since then file "storage.ide" has remained in my modified files, even through I have used a suggested .gitignore for VS, which includes the .vs/ folder. This includes the following.

# Visual Studio 2015 cache/options directory
.vs/

I then added the following to be more specific about ignoring this from the list of files to be tracked

.vs/SIASAWeb/v15/sqlite3/storage.ide
.vs/**/storage.ide

The Changes in the Team Explorer shows the following:

<project folder>
  .vs/<project>/v15/sqlite3
    storage.ide

I have tried to git reset this file, but this then returns on the next commit, and also exists in all branches which I open, resulting in this then preventing the easy shift from one branch to another even if no changes were made.

In the Solution Explorer the "applicationhost.config" and ".suo" files are marked as "ignored", but "storage.ide" is marked as "pending edit".

I have tried committing, synced to the GitHub server, closing and re-opened VS, and even rebooting the computer.

My question is why this file is being maintained as a modified file, even though it should be ignored for git.

Unlike answered 21/8, 2017 at 16:44 Comment(1)
I just started seeing Server and slqite3 folders in v15 which contain db.lock, storage.ide, storage.ide-shm, and storage.ide-wal files. Liam's answer solved it, please "accept" it.Terwilliger
W
63

To fix this, if you got to the Team Explorer tab and click on the Manage Connections button (the green one a the top) you will see a list of local Git Repositories.

Right click on the repository you want to stop tracking the storage.ide file on and select Open Command Prompt.

You should then be able to type the following:

git rm --cached -r .vs

This removes the .vs folder and its contents and subdirectories from being tracked in git.

Whiting answered 5/10, 2017 at 5:39 Comment(1)
Perfect answer.Terwilliger
R
22

This probably means it was incorrectly added to the git repository at some point and then ignored afterwards. git will continue to track changes to gitignored files if they are present in the index ("checked in").

If you don't want the file checked in at all, you can remove it from the index by running

git rm path/to-file --cached

This will keep the contents on disk, if you don't want the file to exist at all you can run

git rm path/to-file --force

Note that this may be undesirable if (for instance) the base project files are intended to be checked in as a starting point for working on the project. And you may just have to be careful about not committing that specific file.

Rotative answered 21/8, 2017 at 16:53 Comment(3)
Thanks Anthony. This fixed the problem. I had to apply this in every branch which I have opened since I upgraded VS. However, in some cases it removes it and then adds it back again immediately.Unlike
I'm not super familiar with VS's git integration (as I haven't worked with it since it was in its infancy) but I can imagine how these things might get out of sync. You may find that fixing it using the git cli while visual studio is closed and then reopening visual studio may help?Rotative
The Git integration in VS will not add the storage.ide file automatically. It was likely accidentally included in a commit at some point, which then made its way around to the different branches. As Anthony mentioned, once a file is committed in a Git repo, the ignore patterns no longer apply to it. If you use git log to view the history of the storage.ide file, it should tell you when it was added.Simoneaux
D
9

the following seems to have solved the issue for me.

# Visual Studio 2015/2017 cache/options directory
*.vs/

it ignores everything in it.

Dunlin answered 14/9, 2017 at 22:36 Comment(0)
H
2

I just had the same issue. I solved it by making a whole new .gitignore file from visual studio's team explorer (Team Explorer => Some git directory => Settings => Repository Settings => Gitignore file Add).

Then I deleted my .vs in my project folder and manually committed by git bash with the following lines:

git add *.*
git commit -m "Removing some files"
git push origin master
Hollingsworth answered 10/4, 2018 at 10:25 Comment(0)
J
-1

I'm using SourceTree(https://www.sourcetreeapp.com/) to manage my git commits. With it you can right click your changes and have an option of Stop Tracking.I used it for the same files you are trying to ignore as myself also just upgraded to 15.3.0 and that was the last time i saw those pending changes

Jett answered 14/9, 2017 at 13:34 Comment(1)
Possibly you could expand your answer telling the original poster (OP) how to do that in his case. Simply saying it worked for me is not really helpful.Delozier

© 2022 - 2025 — McMap. All rights reserved.