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?


Post Footer automatically generated by Add Post Footer Plugin for wordpress.

About Derick Bailey

Derick Bailey is an entrepreneur, problem solver (and creator? :P ), software developer, screecaster, writer, blogger, speaker and technology leader in central Texas (north of Austin). He runs SignalLeaf.com - the amazingly awesome podcast audio hosting service that everyone should be using, and WatchMeCode.net where he throws down the JavaScript gauntlets to get you up to speed. He has been a professional software developer since the late 90's, and has been writing code since the late 80's. Find me on twitter: @derickbailey, @mutedsolutions, @backbonejsclass Find me on the web: SignalLeaf, WatchMeCode, Kendo UI blog, MarionetteJS, My Github profile, On Google+.
This entry was posted in Git. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://www.lostechies.com/members/scottcreynolds/default.aspx Scott C Reynolds

    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

  • http://www.lostechies.com/members/scottcreynolds/default.aspx Scott C Reynolds

    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

  • http://blogs.lessthandot.com chrissie1

    StyleCop.Cache if you use StyleCop.

  • Alexey Abramov

    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

  • http://sergiopereira.com/blog Sergio Pereira

    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

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

  • http://www.tobinharris.com Tobin Harris

    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/

  • http://www.lostechies.com/members/derick.bailey/default.aspx derick.bailey

    @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)

  • http://www.lostechies.com/members/agilejoe/default.aspx Joe Ocampo

    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.

  • http://www.lostechies.com/members/derick.bailey/default.aspx derick.bailey

    @joe,

    done… a month ago. :)
    http://github.com/derickbailey