本文介绍了你如何在 Subversion 下包含/排除某种类型的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对包含/排除行话感到困惑,而我的实际 SVN 客户端似乎没有(或者我无法轻松找到它)一个简单的选项来添加或删除某种类型的文件用于版本控制.

I'm getting confused with the include/exclude jargon, and my actual SVN client doesn't seem to have (or I've been unable to find it easily) a simple option to add or remove a certain type of files for version control.

假设我已经添加了整个 Visual Studio 文件夹及其解决方案、项目、调试文件等,但我只想对实际源文件进行版本控制.最简单的方法是什么?

Let's say for example I've added the entire Visual Studio folder, with its solutions, projects, debug files, etc., but I only want to version the actual source files. What would be the simplest way to do that?

推荐答案

您可能最安全的做法是排除特定文件类型,而不是选择您想要包含的文件类型,因为您随后可能会添加新类型却没有意识到它不是版本化.

You're probably safest excluding particular filetypes, rather than picking those you want to include, as you could then add a new type and not realize it wasn't versioned.

在每个目录的基础上,您可以编辑 svn:ignore 属性.

On a per-directory basis, you can edit the svn:ignore property.

运行

svn propedit svn:ignore .

为每个相关目录打开一个编辑器,其中包含要忽略的模式列表.

for each relevant directory to bring up an editor with a list of patterns to ignore.

然后在与您要忽略的文件类型相对应的每一行上放置一个模式:

Then put a pattern on each line corresponding to the filetype you'd like to ignore:

*.user
*.exe
*.dll

你有什么.

或者,正如建议的那样,您可以将这些模式添加到 ~/.subversion/config 文件(或 "%APPDATA%\Subversion\config)中的 global-ignores 属性" 在 Windows 上 - 参见 红豆书中的配置区域布局了解更多信息).在这种情况下,用空格分隔图案.这是我的.行首的 # 引入注释.我忽略了 Ankh .Load 文件和所有 *.resharper.user 文件:

Alternatively, as has been suggested, you can add those patterns to the global-ignores property in your ~/.subversion/config file (or "%APPDATA%\Subversion\config" on Windows - see Configuration Area Layout in the red bean book for more information). In that case, separate the patterns with spaces. Here's mine. # at the beginning of the line introduces a comment. I've ignored Ankh .Load files and all *.resharper.user files:

### Set global-ignores to a set of whitespace-delimited globs
### which Subversion will ignore in its 'status' output, and
### while importing or adding files and directories.
# global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store
global-ignores = Ankh.Load *.resharper.user

这篇关于你如何在 Subversion 下包含/排除某种类型的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 18:30