最好的通用 SVN 忽略模式?
最好的(或尽可能好的)通用 SVN 忽略模式是什么?
有许多不同的 IDE、编辑器、编译器、插件、平台等特定文件和一些“重叠”的文件类型(即,某些类型的项目需要,而其他类型的项目则不需要)。
但是,无论您的开发环境的具体情况如何,您永远都不希望将大量文件类型自动包含在源代码管理中。
这个问题的答案将作为任何项目的良好起点- 仅要求他们添加他们需要的少数环境特定项目。 它也可以适用于其他版本控制系统(VCS)。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(17)
Visual Studio (VC++) 用户绝对需要排除 .ncb 文件
Visual Studio (VC++) users definitely need to exclude the .ncb files
基于 Burly 的忽略模式,我已将 ReSharper 添加到忽略列表
格式化为复制和粘贴:
格式化为可读性:
Based on Burly's ignore pattern, I have added ReSharper to the ignore list
Formatted for copy and paste:
Formatted for readability:
我的 Visual Studio 忽略模式:
格式化以提高可读性
My ignore pattern for Visual Studio:
Formatted for readability
每当我在存储库中遇到通常不需要的文件时,我都会更新模式。 我相信没有“最佳”模式 - 它总是取决于您开发的语言和环境。
此外,您不太可能想到所有可能的“可忽略”文件类型 - 您'您总会遇到您忘记包含的文件类型。 这就是为什么随时更新模式效果最好。
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.
Windows 用户可能想要添加desktop.ini 和thumbs.db。
Windows users might want to throw in desktop.ini and thumbs.db.
用于我的 Visual Studio 项目
您可以从那里扩展更多文件类型。
Used for my Visual Studio projects
You can expand more file types from there.
我将对此问题添加我自己的两分钱:
我将以下 SVN 忽略模式与 TortoiseSVN 和 Subversion CLI 用于 Windows 和 Linux 平台上的本机 C++、C#/VB.NET 和 PERL 项目。 这对我来说很有效!
格式化为复制和粘贴:
格式化为可读性:
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:
Formatted for readability:
如果您使用 Resharper,则必须将其添加到其中。
另一个需要注意的是 Ankh*.*
Gotta add Resharper to the mix if you use one.
another one to look out for is Ankh*.*
不要忘记 NCrunch 临时文件:
Don't forget NCrunch temporary files:
该模式取决于您使用的操作系统。
在 Linux 上,您首先需要阻止 **.o*、**.so*、**.a* 和 **.la*。 您可能还想阻止***~*(防止编辑备份文件)和#*#(防止 emacs 崩溃备份)。
在 Windows 上,您至少需要 **.obj*、**.lib* 和 **.dll*。
您需要阻止的任何其他文件取决于您的 IDE、编辑器和编译器。
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.
Visual Studio 2010 用户应添加
ipch
(包含 C++ 预编译标头的文件夹)和*.sdf
(intellisense 用于任何类型项目的巨大文件)。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).由于您可能使用第三方库和 dll 作为项目的一部分,因此我认为从存储库中阻止 *.lib 和 *.dll 并不明智。 这些是要存储在存储库中的内容。
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.
Mac 用户可能想加入 .DS_Store。 另外,如果有开发人员使用 Emacs 或 Vim,您可能需要添加 ~~ 和 ##。
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 ##.
对于 Eclipse,我使用:
.* 获取所有项目配置。 您几乎不想签入“隐藏”目录或文件,但如果它出现,您仍然可以 svn 添加它。
For Eclipse, I use:
.* 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.
gitignore.io 为 git 提供可配置模式。 它们提供了一个可读列表,您需要为 SVN 重新格式化该列表。
例如,请求 MicrosoftOffice 和 Windows 返回
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
和核心转储(cygwin、linux)
And core dumps (cygwin, linux)
gitignore.io 为 git 提供可配置模式。 它们提供了一个可读列表,您需要为 SVN 重新格式化该列表。
例如,请求MicrosoftOffice和Windows返回
似乎可以直接用作
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
It seems that it can be directly used as
svn:global-ignore