views:

2001

answers:

3

I wan to place a VB.NET project under Git control in Windows (was previously under Visual Source Safe - long sad story of repository corruption, etc.). How should I set up the ignore file? The exclusions I'm thinking of using are:

  • *.exe
  • *.pdb
  • *.manifest
  • *.xml
  • *.log (is Git case sensitive on Windows? Should I exclude *.l og as well?)
  • *.scc (I gather these were left over from Visual Source Safe - maybe I should delete them?)

Is this a sensible list? Should I be excluding directories?

+12  A: 

Here's what I have for my C# projects:

ProjectName/bin
ProjectName/obj
*.user
*.suo
_ReSharper.*
*.sln.cache

With the bin/obj directories gone, you don't need to exclude all EXEs, XML files etc - which is handy, as it means you still get to put in the ones you want :) (You might have sample XML files etc.)

Jon Skeet
Great list, one problem I had was with some projects which I hadn't created a directory for the solution so the `bin` and `obj` directories were in the same directory as the `.gitignore` file. I ended up using `[Bb]in/` and `[Oo]bj/` for the rules to catch both locations as well as case differences.
joshperry
A: 

Delete the existing .scc files. They're Source Safe junk.

You'll also want to exclude: .licx (license files,) .dll, .suo, .ncb, .vspcc, .vscc, and .vssscc files. The last three are generated by Visual Studio to keep track of source control bindings.

Jekke
Don't exclude DLLs - you'll want to include any libraries you reference (NUnit etc).
Jon Skeet
Obviously, excluding DLLs should be evaluated on a shop-by-shop basis. We exclude DLLs from our source control because all the ones in our repository are generated by the compiler. You may be able to get the same result by excluding \bin.
Jekke
+2  A: 

We use the following, all of our shared stuff (dll, exe, bat, etc) are kept in a a folder named "lib", this way it stays clean and we can put anything we want in lib and it is excluded from the ignore rules.

[Bb]in/
[Oo]bj/
!/lib
*.user
*.suo
_ReSharper.*
*.sln.cache
*.xap
*.vspcc
*.vscc 
*.vssscc

BTW, yes .gitignore is case sensitive even in Windows, so yes you need to include multiple cases. Visual Studio will sometimes create a Bin folder instead of bin if you are working with Silverlight or WPF applications. The same applies for Obj. Some external tools will do that as well. The extension names, from what I have been able to tell, are lowercase in all cases, unless of course you modify it (another hack if you want to remove a single file from the git add . command, BTW).

emalamisura