177

什么是最好的(或尽可能好的)通用 SVN 忽略模式?

有许多不同的 IDE、编辑器、编译器、插件、平台等特定文件和一些“重叠”的文件类型(即,某些类型的项目需要,而其他类型的项目不需要)。

但是,无论您的开发环境的具体情况如何,您都不想将大量文件类型自动包含在源代码管理中。

这个问题的答案可以作为任何项目的一个很好的起点——只需要他们添加他们需要的几个特定于环境的项目。它也可以适用于其他版本控制系统 (VCS)。

4

17 回答 17

195

我会在这个问题上加上我自己的两分钱:

我将以下 SVN 忽略模式与 TortoiseSVN 和 Subversion CLI 一起用于 Windows 和 Linux 平台上的本机 C++、C#/VB.NET 和 PERL 项目。这对我来说很有效!

格式化为复制和粘贴:

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

为便于阅读而格式化:

*.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  
发布发布调试调试
忽略 忽略 bin Bin obj Obj
*.csproj.user *.user
*.generated.cs
于 2008-09-17T17:01:30.870 回答
44

基于 Burly 的忽略模式,我已将 ReSharper 添加到忽略列表

格式化为复制和粘贴:

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

为便于阅读而格式化:

*.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
于 2009-05-09T12:06:53.213 回答
35

我对 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 日志输出 TestResults *.crunchsolution .* *.crunchproject.*

为可读性而格式化

*/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 日志输出 TestResults
*.crunchsolution.* *.crunchproject.*
于 2009-11-29T13:00:54.610 回答
16

每次我在存储库中遇到我通常不想要的文件时,我都会更新模式。我相信没有“最好”的模式——它总是取决于你开发的语言和环境。

此外,您不太可能想到所有可能的“可忽略”文件类型 - 您总是会遇到您忘记包含的文件类型。这就是为什么随时更新模式效果最好的原因。

于 2008-09-17T17:05:49.797 回答
11

Windows 用户可能想要添加 desktop.ini 和 thumbs.db。

于 2008-09-17T17:02:20.103 回答
4

用于我的 Visual Studio 项目

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

您可以从那里扩展更多文件类型。

于 2008-09-17T17:01:13.693 回答
3

Visual Studio (VC++) 用户肯定需要排除.ncb文件

于 2008-09-17T17:04:18.817 回答
1

Mac 用户可能想要加入 .DS_Store。另外,如果有开发者使用 Emacs 或 Vim,你可能需要添加~~ 和##。

于 2008-09-17T17:06:17.393 回答
1

对于 Eclipse,我使用:

bin
.*

.* 获取所有项目配置。您几乎从不想签入“隐藏”目录或文件,但如果出现,您仍然可以 svn 添加它。

于 2008-09-17T17:08:25.797 回答
1

由于您可能将第三方库和 dll 用作项目的一部分,因此我看不到从存储库中阻止 *.lib 和 *.dll 的智慧。这些是要存储在存储库中的东西。

于 2008-10-09T09:20:08.537 回答
1

Visual Studio 2010 用户应添加ipch(包含 C++ 预编译头文件的文件夹)和*.sdf(intellisense 用于任何类型项目的巨大文件)。

于 2011-08-01T17:54:01.260 回答
0

该模式取决于您使用的操作系统。

在 Linux 上,您首先需要阻止 **.o*、**.so*、**.a* 和 **.la*。您可能还想阻止 **~*(编辑备份文件)和 #*#(崩溃时的 emacs 备份)。

在 Windows 上,您至少需要 **.obj*、**.lib* 和 **.dll*。

您需要阻止的任何其他文件取决于您的 IDE、编辑器和编译器。

于 2008-09-17T17:07:35.317 回答
0

如果您使用 Resharper,则必须添加 Resharper。

另一个需要注意的是 Ankh*.*

于 2010-06-21T05:42:44.760 回答
0

不要忘记NCrunch临时文件:

*.crunchsolution.* *.crunchproject.*
于 2011-10-14T08:15:20.773 回答
0

和核心转储(cygwin,linux)

*.stackdump core.*
于 2013-07-16T09:14:14.360 回答
0

gitignore.io为 git 提供了可配置的模式。它们提供了一个可读的列表,您需要为 SVN 重新格式化。

例如,请求 MicrosoftOffice 和 Windows返回

# 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
于 2016-09-13T08:59:39.283 回答
0

gitignore.io为 git 提供了可配置的模式。它们提供了一个可读的列表,您需要为 SVN 重新格式化。

例如,请求 MicrosoftOffice 和 Windows返回

# 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

好像可以直接当svn:global-ignore

于 2016-09-13T09:07:00.000 回答