views:

10199

answers:

13

What is the best (or as good as possible) general SVN ignore pattern to use?

There are a number of different IDE, editor, compiler, plug-in, platform, etc. specific files and some file types that "overlap" (i.e. desirable for some types projects and not for others).

There are however, a large number of file types that you just never want included in source control automatically regardless the specifics of your development environment.

The answer to this question would serve as a good starting point for any project - only requiring them to add the few environment specific items they need. It could be adapted for other Version Control Systems (VCS) as well.

+1  A: 

Used for my Visual Studio projects

*/bin */obj *.user *.suo

You can expand more file types from there.

icelava
I saw a similar list earlier today -- what's the difference between */bin and just bin? Assuming you want to ignore the whole folder.
harpo
Read section 5.13. Ignoring Files And Directories of the TortoiseSVN help file.
icelava
http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-ignore.htmlThere it says that you shouldn't include a / or \, and that including them is a legacy of earlier versions
Simon D
+41  A: 

I'll add my own two cents to this question:

I use the following SVN ignore pattern with TortoiseSVN and Subversion CLI for native C++, C#/VB.NET, and PERL projects on both Windows and Linux platforms. It works well for me!

Formatted for copy and paste:

*.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store thumbs.db Thumbs.db *.bak *.class *.exe *.dll *.mine *.obj *.ncb *.lib *.log *.idb *.pdb *.ilk *.msi* .res *.pch *.suo *.exp *.*~ *.~* ~*.* cvs CVS .CVS .cvs release Release debug Debug ignore Ignore bin Bin obj Obj *.csproj.user *.user

Formatted for readability:

*.o *.lo *.la #*# .*.rej *.rej
.*~ *~ .#* .DS_Store thumbs.db 
Thumbs.db *.bak *.class *.exe *.dll
*.mine *.obj *.ncb *.lib *.log 
*.idb *.pdb *.ilk *.msi* .res *.pch *.suo 
*.exp *.*~ *.~* ~*.* cvs  CVS .CVS .cvs  
release Release debug Debug
ignore Ignore bin Bin obj  Obj
*.csproj.user *.user
Burly
@blorgbeard - I'm rolling back your formatting changes because I believe it's preferrable to have it all on one line for copy/paste into the SVN configuration file (which doesn't accept multi-line input).
Burly
Tweaked it .
George Stocker
What about *.tmp *.temp?
Bob King
Also, if you do WPF *.g.vb *.g.cs *.baml *.GenerateResource.Cache *.cache
Bob King
is *.dll required as it may be case when the reference assemblies needs to be commited also in repository?
Xabatcha
@Xabatcha - You can always explicitly include a file of any extension (or folder) regardless of whether it is listed in the global ignore pattern or not. Generally you do not want *.dll being tracked by SVN however you can always explicitly add any necessary ones (which I often do in the case of third-party assemblies).
Burly
If you're using ReSharper the add that too
mattRo55
Add *.xap for Silverlight projects.
Matt Casto
+5  A: 

Windows users might want to throw in desktop.ini and thumbs.db.

harpo
+2  A: 

Visual Studio (VC++) users definitely need to exclude the .ncb files

Rob Walker
+9  A: 

Every time I come across a file I generally do not want in the repository, I update the pattern. I believe there is no "best" pattern - it always depends on the language and environment you develop in.

Moreover, you're not very likely to think of all the possible "ignorable" filetypes - you'll always encounter a filetype you simply forgot to include. Thats why updating the pattern as you go works the best.

petr k.
Burly
Also while adding them as you go works alright for single developer environments, when you have multiple developers on a project, having a common project ignore pattern is desirable. You want to have to update it as infrequently as possible, so you want to knock out as many as possible up front
Burly
Of course, the usual pattern of *.bin *.bak *.pdb *.suo etc etc must be set up front, I agree.But once you set the ignore properties on a repository folder, they do effectively become shared - although I am aware this is not exactly what you meant.
petr k.
A: 

Mac users probably want to throw in .DS_Store. In addition, if there are dev's using Emacs or Vim, you probably want to add ~~ and ##.

James Deville
A: 

The pattern depends on which operating system you're using.

On Linux, you'll want to block *.o, *.so, *.a, and *.la to begin with. You may also want to block *~ (backup file from editing) and #*# (emacs backup from a crash).

On Windows, you'll want *.obj, *.lib, and *.dll at the very least.

Any other files you need to block depend on your IDE, editor, and compiler.

Branan
+1  A: 

For Eclipse, I use:

bin
.*

.* gets all the project configuration. You almost never want to check in a 'hidden' directory or file, but if it comes up, you can still svn add it.

noah
+1  A: 

Since you may be using third party libs and dll's as part of the project(s) then I don't see the wisdom in blocking *.lib and *.dll from the repository. These are the things that are meant to be stored in the repository.

graham.reeds
When using third party libs, dlls, exes, etc. just explicitly add them. If you want to a do an entire 3rd party tree, just temporarily disable the ignore pattern. You don't want these types being picked up implicitly during day-to-day development however, hence their inclusion in the pattern.
Burly
A: 

I am trying to use TortoiseSVN Settings, as described by @Burly's answer, but a) I have to exclude from the commit list the types I don't want to store, and b) it leaves most of my source folders marked as 'modified'... Am I missing something basic? Or is it better to just store all the file types? Thanks in advance.

Paul Morrison
I'm not sure I understand what issue you are running into. The ignore pattern should be added to the TortoiseSVN Settings "Global ignore pattern:" and in the Subversion configuration file in the "global-ignores" section.
Burly
This will cause TortoiseSVN to automatically ignore all files that match and thus, not store any of them in your repository. Think of this as blacklist of things you don't want stored in your repo. "Allow all, deny blacklist"
Burly
Ah! I didn't know about the config file - that's probably the answer! Do you have any opinions about which types to ignore - in, say, the Windows environment? E.g. .dll, .bin, .cache, etc. TIA
Paul Morrison
The list above should suffice as a good starting point, regardless of platform. The items that are *nix specific tend never to exist in a Windows environment. That said, everything starting with thumbs.db and there after are fairly windows specific. Hope that helps!
Burly
Thanks, @Burly! It's starting to look pretty good! It seems to be the combination of the two - plus the "Delete (keep local)" function - that does the trick!
Paul Morrison
Excellent, glad it's working out for you!
Burly
+10  A: 

Based on Burly's ignore pattern, I have added ReSharper to the ignore list

*.o .lo .la ## ..rej .rej .~ ~ .# .DS_Store thumbs.db Thumbs.db *.bak *.class *.exe *.dll *.mine *.obj *.ncb *.lib *.log *.idb *.pdb *.ilk .msi .res *.pch *.suo *.exp .~ .~ ~. cvs CVS .CVS .cvs release Release debug Debug ignore Ignore bin Bin obj Obj *.csproj.user *.user ReSharper. *.resharper.user

3/7

+3  A: 

My ignore pattern for Visual Studio:

*/bin */obj */Release */Debug *.suo *.err *.log *.obj *.bin *.dll *.exe *.LOG *.user *.pdb [tT]emp [tT]empPE Ankh.Load thumbs.db *.resharper *.vspscc *.vsssccc *.scc */_ReSharper* */_ReSharper.* bin obj *.resharperoptions *.db *.bak *_ReSharper* *.snk logs output TestResults

XY3
A: 

Gotta add Resharper to the mix if you use one.

another one to look out for is Ankh*.*

Hammad Rajjoub
Yeah, I left out most of the tool specific flags except for Visual Studio. Hopefully others continue to add answers with explicit file pattern lists for their various tools!
Burly