Gitignore won't ignore .vs folder for Visual Studio

We've tried all sorts of explicit and wildcard entries in .gitignore however items in the hidden .vs/ folder as a part of Visual Studio keep getting committed.


Since those are individual settings for developers, they are obviously always different and show up in a git diff.

Are there any hacks out there to ignore everything in the top-level .vs/ folder in the repo?


This answer is similar to ones above but, details actual steps when a valid .gitignore file is inplace, yet items have been checked into the branch and they appear in the origin repository.

  1. If the .vs directory has been checked in verify nothing in the current branch has been staged from the directory. If so, un-stage them.
  2. Go to the level of the directory which has .vs.
  3. Run this command: git rm --cached -r .vs.
  4. At this point you should see the files under the .vs directory as slated for deletion.
  5. Stage and create the commit.
  6. Push the commit to origin.

Share :

Gitignore won't ignore .vs folder for Visual Studio