Los Techies : Blogs about software and anything tech!

A .NET (C#) Developer’s .gitignore File


As a recent convert to the awesomeness that is git (my current flavor is msysgit), I find myself continuously needing to update the .gitignore file that I copy and paste between my repositories. Here’s what my ignore file currently contains:

obj
bin
deploy
deploy/*
_ReSharper.*
*.csproj.user
*.resharper.user
*.resharper
*.suo
*.cache
~$*

The “~$*” line is for MS Office temp files. Other than that, it’s a pretty common list of files and folders that .NET (C#) developers would want to ignore in the git repositories.

What does your .gitignore file look like? What am I missing from mine?

Kick It on DotNetKicks.com
Posted May 18 2009, 10:55 PM by derick.bailey
Filed under:

Comments

Scott C Reynolds wrote re: A .NET (C#) Developer’s .gitignore File
on 05-19-2009 12:07 AM

If you use monodevelop add:

*.usertasks

*.userprefs

and if you have 3rd party components with bad licensing tech, you will want to ignore also

*.licx

Scott C Reynolds wrote re: A .NET (C#) Developer’s .gitignore File
on 05-19-2009 12:10 AM

another tip - you can do a "global" .gitignore with git config, but that won't work on a shared repo. However, you can save a stock .gitignore in some root folder (i keep mine in ~/code) and then alias the "git init" or "git clone" commands to include copying that .gitignore to the local dir

chrissie1 wrote re: A .NET (C#) Developer’s .gitignore File
on 05-19-2009 2:27 AM

StyleCop.Cache if you use StyleCop.

Alexey Abramov wrote re: A .NET (C#) Developer’s .gitignore File
on 05-19-2009 8:52 AM

This is global svn ignore pattern of our team (.Net developers + some Dreamweaver users). Thanks for sharing!

*.bak

*.cache

*.dll

*.log

*.obj

*.suo

*.swp

*.user

*ReSharper*

*resharper*

_compareTemp

_notes

aspnet_client

bin

bin/*

httpd.parse.errors

obj  

Thumbs.db

Sergio Pereira wrote re: A .NET (C#) Developer’s .gitignore File
on 05-19-2009 9:09 AM

If you use a file-based DB or file-based logs, you may  want to account for those too. In my case I very often have machine-specific config settings that go in a file that I don't want in the repo.

mendicant wrote re: A .NET (C#) Developer’s .gitignore File
on 05-19-2009 10:14 AM

If I'm not mistaken, the *.resharper will kill solutionwide settings for resharper (if you're using them).

Arjan`s World » LINKBLOG for May 19, 2009 wrote Arjan`s World » LINKBLOG for May 19, 2009
on 05-19-2009 11:26 AM

Pingback from  Arjan`s World    » LINKBLOG for May 19, 2009

Tobin Harris wrote re: A .NET (C#) Developer’s .gitignore File
on 05-19-2009 6:47 PM

Awesome.

Surely, this belongs in a gist :)

http://gist.github.com/114476

Mine is very similar...

obj/

Obj/

bin/

Bin/

*.suo

*.resharper.user

_ReSharper.*

Tmp/

Log/

Uploads/

derick.bailey wrote re: A .NET (C#) Developer’s .gitignore File
on 05-19-2009 9:55 PM

@tobin,

good call! :)

@everyone else,

thanks everyone! the input is greatly appreciated, and appears to be helping a good number of people already (based on page views, google search results, etc)

Joe Ocampo wrote re: A .NET (C#) Developer’s .gitignore File
on 05-19-2009 11:51 PM

You should create a GitHub account and place this file there so you can reference it at any time.  That and you can share it with the community.

derick.bailey wrote re: A .NET (C#) Developer’s .gitignore File
on 05-20-2009 9:14 AM

@joe,

done... a month ago. :)

http://github.com/derickbailey

Twitted by HEskandari wrote Twitted by HEskandari
on 10-26-2009 3:41 AM

Pingback from  Twitted by HEskandari

new ThoughtStream("Derick Bailey"); wrote Branch-Per-Feature: How I Manage Subversion With Git Branches
on 02-03-2010 4:37 PM

Anyone that follow me on twitter likely knows that I’m a big fan of Git these days. I’ll spare you the

Matt's blog » Blog Archive » Git :) wrote Matt's blog » Blog Archive » Git :)
on 02-18-2010 12:15 AM

Pingback from  Matt's blog  » Blog Archive   » Git :)

Copyright Los Techies 2008, 2009. All rights reserved.
Powered by Community Server (Commercial Edition), by Telligent Systems