Kelly S. French
Kelly S. French

Reputation: 12344

Files to ignore when using Visual Studio with Git

I've installed Git to do some development using Visual Studio 2008. Most of the work will be new development but we do have some old projects from prior to VS2005 that I want to bring over into the new repository. There is an existing thread about general VS/Git integration but my question is limited to the .gitignore file and Visual Studio.

My question has two parts:

I already know the HOW. Here is an excerpt from the Git user-manual on ignoring files.

If you wish the exclude patterns to affect only certain repositories (instead of every repository for a given project), you may instead put them in a file in your repository named .git/info/exclude, or in any file specified by the core.excludesfile configuration variable. Some git commands can also take exclude patterns directly on the command line. See gitignore(5) for the details.

Upvotes: 14

Views: 13505

Answers (4)

KyleMit
KyleMit

Reputation: 30267

If you have node installed, you can run npx gitignore to generate .gitignore files:

npx gitignore VisualStudio

Upvotes: 1

user195595
user195595

Reputation: 1294

In GitExtensions the default .gitignore is this. It can be a bit shorted by removing most individual file extensions and only exclude the directories they are in.

*.obj
*.exe
*.exp
*.pdb
*.dll
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.zip
[Dd]ebug*/
*.lib
*.sbr
Thumbs.db
[Ll]ib/
[Rr]elease*/
[Tt]est[Rr]esults/
_UpgradeReport_Files/
_ReSharper.*/

Upvotes: 9

Michael Hackner
Michael Hackner

Reputation: 8645

You should ignore:

  • the bin directory
  • the obj directory
  • *.suo
  • *.user

Upvotes: 7

Related Questions