SVN 忽略像 .gitignore [英] SVN ignore like .gitignore

查看:54
本文介绍了SVN 忽略像 .gitignore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Git 中,如果我有一个包含很多项目的项目,让我们假设,很多 Java 项目,我只需在根目录中创建一个 .gitignore 文件,它就会在整个存储库中受到尊重".

In Git, if I have a project with lots of projects inside, let's suppose, a lot of Java projects, I can just create a .gitignore file in the root and it will "be respected" in the entire repository.

如何为 SVN 项目执行此操作?

How can I do this for an SVN project?

例如,如何为 .gitignore 进行svn ignore"设置(通过 cmd 行),如下所示?

For example, how can I make an "svn ignore" setup (via cmd line) for a .gitignore like the following?

*.class
*.jar
*.war
*.ear
target/
.classpath
.settings/
.project
.metadata
bin/

问题中最重要的部分:如何使其适用于根目录中的新文件夹?示例:

The most important part of the question: How can I make it work to new folders inside the root? Example:

我运行了 svn propset svn:ignore "*.class" .-R 在我的根目录中并提交.好的:

I ran svn propset svn:ignore "*.class" . -R in my root and commit. Ok:

root
- folder1/
-- *.class (ignored)
-- other files (ok)
- folder2/
-- *.class (ignored)
-- other files (ok)

现在,我创建文件夹 3.之前的 svn:ignore 设置将不适用,对吗?有没有办法做到这一点?

Now, I create folder 3. The previous svn:ignore settings will not apply, right? Is there a way to make it so?

推荐答案

您可以使用 svn:ignore.您通常需要告诉 SVN 将特殊属性应用于文件:

You can use svn:ignore. You generally need to tell SVN to apply special properties to the files:

svn propset svn:ignore "*.jpg" .

(注意命令末尾的点.)

(Note the dot at the end of the command.)

对于多个文件,您可以添加换行符.

For multiple files you can add a newline character.

与此处完全相同并带有换行符:

Type exactly like here with line breaks:

svn propset svn:ignore "file1
file2
file3" dir1

检查文件是否被忽略:

svn status --no-ignore

然后提交代码.

是的,已经有很多重复的问题了.

And yes, many duplicate questions are already available.

你可以参考我最喜欢的svn cheatguide.

You can refer my favorite svn cheatguide.

您可以使用您忽略的文件和目录创建一个文件 svn-ignore.txt:

You can create a file, svn-ignore.txt, with your ignored files and directories:

*.class
*.jar
*.war
*.ear
 target/
.classpath
.settings/
.project
.metadata
 bin/

现在尝试以下操作:

svn propset svn:ignore -RF /root/svn-ignore.txt . [dot for current dir]

-R 用于递归.

这篇关于SVN 忽略像 .gitignore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆