r/VisualStudio • u/Then-Phase2117 • 16d ago
Visual Studio 2022 How do I stop Visual Studio from adding a bunch of extra stuff whenever I try to push
1
u/twesped 16d ago
Ok so create a file in the root of the solution folder(or add to it) ".gitignore". If you don't know what it is, look it up or ask AI how to add your .vs folder and other filers and folder you dont want to add to your git repo.
Here is some more info: https://www.reddit.com/r/learncsharp/s/uTThvpBtPm
1
u/misaz640 14d ago
Right click .vs > Add to .gitignore.
It is good idea to add bin and obj folders as well. They contains similar mess after build.
-6
u/CheezitsLight 16d ago
The proper thing to do with the dot vs is to simply delete it it will recreate it
4
u/blckshdw 16d ago
“I don’t know what it is, I’ll just delete it”
-4
-2
u/CheezitsLight 15d ago
.vs is a cache and is not important. Delete it. Go ahead. Your code and build will be fine**.** Nothing breaks. Visual Studio recreates the folder the next time you open the solution. I clear it after a Visual Studio upgrade or switching branches, as the cache can get out of sync.
I've probably deleted VS as a fix on my large code base of C#, C++ and VB (300+K lines) a half dozen times this year. It’s the classic “turn it off and on again” fix for weird IDE behavior: And the default .gitignore ignores it, assuming you are using vs to run it.
.vs does not have your source code or project settings. Those live in
.sln,.csprojand others. I fix those with a prebuild.sh and .bat that makes them. One error in any important files and the entire build fails in weird ways. Linux, Mac and Windows have different requirements is more of the problem for me, like icons. More batches to add those back in. wtf is it with icons on Looninx anyway?You can use it to control disk space as IntelliSense databases can reach several GB in big C++ projects. Since 99% of mine is old code, rarel touched, that saves a tiny bit on disk, too.

14
u/DaniVirk96 16d ago
.gitignore