最好的通用 SVN 忽略模式?
题
最好的(或尽可能好的)通用 SVN 忽略模式是什么?
有许多不同的IDE、编辑器、编译器、插件、平台等。特定文件和某些“重叠”的文件类型(即对于某些类型的项目来说是理想的,而对于其他类型的项目则不是)。
然而,无论您的开发环境的具体情况如何,您永远都不希望将大量文件类型自动包含在源代码管理中。
这个问题的答案将作为任何项目的良好起点 - 只需要他们添加一些他们需要的环境特定项目。它也可以适用于其他版本控制系统(VCS)。
解决方案
我将在这个问题上添加我自己的两分钱:
我将以下 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 release Release debug Debug ignore Ignore bin Bin obj Obj *.csproj.user *.user *.generated.cs
其他提示
基于 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
我的 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.*
格式化以提高可读性
*/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.*
每当我在存储库中遇到通常不需要的文件时,我都会更新模式。我相信没有“最好”的模式——它总是 取决于语言和环境 你发展于.
此外,您不太可能想到所有可能的“可忽略”文件类型 - 您总是会遇到您只是忘记包含的文件类型。这就是为什么随时更新模式效果最好。
Windows 用户可能想要添加desktop.ini 和thumbs.db。
用于我的 Visual Studio 项目
*/bin */obj *.user *.suo
您可以从那里扩展更多文件类型。
Visual Studio (VC++) 用户绝对需要排除 .ncb 文件
Mac 用户可能想加入 .DS_Store。另外,如果有开发者使用 Emacs 或 Vim,你可能需要添加 ~〜和##.
对于 Eclipse,我使用:
bin
.*
.* 获取所有项目配置。您几乎不想签入“隐藏”目录或文件,但如果它出现,您仍然可以 svn 添加它。
由于您可能使用第三方库和 dll 作为项目的一部分,因此我认为从存储库中阻止 *.lib 和 *.dll 并不明智。这些是要存储在存储库中的内容。
Visual Studio 2010 用户应添加 ipch
(包含 C++ 预编译头的文件夹)和 *.sdf
(智能感知用于任何类型的项目的巨大文件)。
该模式取决于您使用的操作系统。
在 Linux 上,您首先需要阻止 **.o*、**.so*、**.a* 和 **.la*。您可能还想阻止***~*(防止编辑备份文件)和#*#(防止 emacs 崩溃备份)。
在 Windows 上,您至少需要 **.obj*、**.lib* 和 **.dll*。
您需要阻止的任何其他文件取决于您的 IDE、编辑器和编译器。
如果您使用 Resharper,则必须将其添加到其中。
另一个需要注意的是 Ankh*.*
别忘了 数控加工 临时文件:
*.crunchsolution.* *.crunchproject.*
和核心转储(cygwin、linux)
*.stackdump core.*
gitignore.io 为 git 提供可配置模式。它们提供了一个可读列表,您需要为 SVN 重新格式化该列表。
例如, 请求 Microsoft Office 和 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
gitignore.io 为 git 提供可配置模式。它们提供了一个可读列表,您需要为 SVN 重新格式化该列表。
例如, 请求 Microsoft Office 和 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