Welcome

You have reached the blog of Keith Elder. Thank you for visiting! Feel free to click the twitter icon to the right and follow me on twitter.

Sample .gitignore or exclude for .NET / Visual Studio / C#

Posted by Keith Elder | Posted in .Net, Open Source | Posted on 29-01-2011

Yesterday late in the evening after an incredibly long day I had a brain fart and twittered this.

image 

Literally a few seconds later I was bombarded with “update your .gitignore” file. 

I literally slapped my forehead and said DUH!

 

Why? Well it is typical for version control systems such as GIT or CVS or SVN to have ignore files, I was just being lazy and not using my brain. Probably because it had been all but used up for that day.  Anyway there were some sample .gitignore files my fellow twitters sent me to but really they didn’t do the job so I am posting a sample file to help someone else out. 

Actually this is a sample “exclude” file which is in .git/info/exclude.  The exclude file is local to the repository it is in and isn’t global.  See http://help.github.com/git-ignore/ for more details on how this works.  Here is my current file which I will keep up-to-date as I go.

#git ls-files –others –exclude-from=.git/info/exclude
# Lines that start with ‘#’ are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

# there are two bins here because apparently Silverlight calls the folder Bin instead of bin
# these folders should never be checked in as this contains the compiled code for configurations
bin
Bin
obj

# this is a Visual Studio user solution file, it contains your personal settings and should not be checked in
# if sharing the repo with other people, if it is just your repo you can remove this
*.suo

# this folder is created when using RIA Services with a Silverlight application, the code from one project
# is copied here, thus it shouldn’t be checked into source control
Generated_Code

# Projects can also have user settings so this ignores those files as well
*.user

This probably isn’t all inclusive just yet but as I find more things I’ll update this post.  Thanks.

Comments (1)

You can replace your two bins with “[Bb]in”

Write a comment