Best general SVN Ignore Pattern?

SvnLanguage AgnosticVersion ControlDevelopment EnvironmentEnvironment

Svn Problem Overview


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.

Svn Solutions


Solution 1 - Svn

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 *.generated.cs

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 *.generated.cs

Solution 2 - Svn

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

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 _ReSharper.* *.resharper.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 _ReSharper.* *.resharper.user

Solution 3 - Svn

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 .crunchsolution. .crunchproject.

Formatted for readability

*/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
.crunchsolution. .crunchproject.

Solution 4 - Svn

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.

Solution 5 - Svn

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

Solution 6 - Svn

Used for my Visual Studio projects

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

You can expand more file types from there.

Solution 7 - Svn

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

Solution 8 - Svn

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 ##.

Solution 9 - Svn

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.

Solution 10 - Svn

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.

Solution 11 - Svn

Visual Studio 2010 users should add ipch (a folder which contains C++ precompiled headers) and *.sdf (huge files used by intellisense for any kind of project).

Solution 12 - Svn

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.

Solution 13 - Svn

Gotta add Resharper to the mix if you use one.

another one to look out for is Ankh*.*

Solution 14 - Svn

Don't forget NCrunch temporary files:

*.crunchsolution.* *.crunchproject.*

Solution 15 - Svn

And core dumps (cygwin, linux)

*.stackdump core.*

Solution 16 - Svn

gitignore.io provides configurable patterns for git. They provide a readable list, which you need to reformat for SVN.

For instance, requesting MicrosoftOffice and Windows returns

# Created by https://www.gitignore.io/api/microsoftoffice,windows

### MicrosoftOffice ###
*.tmp

# Word temporary
~$*.doc*

# Excel temporary
~$*.xls*

# Excel Backup File
*.xlk

# PowerPoint temporary
~$*.ppt*

# Visio autosave temporary files
*.~vsdx


### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

Solution 17 - Svn

gitignore.io provides configurable patterns for git. They provide a readable list, which you need to reformat for SVN.

For instance, requesting MicrosoftOffice and Windows returns

# Created by https://www.gitignore.io/api/microsoftoffice,windows

### MicrosoftOffice ###
*.tmp

# Word temporary
~$*.doc*

# Excel temporary
~$*.xls*

# Excel Backup File
*.xlk

# PowerPoint temporary
~$*.ppt*

# Visio autosave temporary files
*.~vsdx


### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

It seems that it can be directly used as svn:global-ignore

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionZach BurlingameView Question on Stackoverflow
Solution 1 - SvnZach BurlingameView Answer on Stackoverflow
Solution 2 - SvnThree SeventhsView Answer on Stackoverflow
Solution 3 - SvnDima PaskoView Answer on Stackoverflow
Solution 4 - Svnpetr k.View Answer on Stackoverflow
Solution 5 - SvnharpoView Answer on Stackoverflow
Solution 6 - SvnicelavaView Answer on Stackoverflow
Solution 7 - SvnRob WalkerView Answer on Stackoverflow
Solution 8 - SvnJim DevilleView Answer on Stackoverflow
Solution 9 - SvnnoahView Answer on Stackoverflow
Solution 10 - Svngraham.reedsView Answer on Stackoverflow
Solution 11 - SvnDalmasView Answer on Stackoverflow
Solution 12 - SvnBrananView Answer on Stackoverflow
Solution 13 - SvnHammad RajjoubView Answer on Stackoverflow
Solution 14 - SvnRichard DingwallView Answer on Stackoverflow
Solution 15 - SvnHolger BilleView Answer on Stackoverflow
Solution 16 - SvnkopporView Answer on Stackoverflow
Solution 17 - SvnkopporView Answer on Stackoverflow