Linux 如何忽略 Subversion 中的目录/文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14346717/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 18:40:59  来源:igfitidea点击:

How to ignore directories/files in Subversion?

javalinuxspringsvnmaven

提问by techsjs2012

How to setup my Subversion so it ignores target files generated by Maven on Linux? I don't want to commit them into SVN.

如何设置我的 Subversion 使其忽略 Linux 上由 Maven 生成的目标文件?我不想将它们提交到 SVN。

How do I do this on Linux and Mac command line?

如何在 Linux 和 Mac 命令行上执行此操作?

采纳答案by Adam Schreiner

To ignore files in subversion you want to set the svn:ignore property. You can see more here http://svnbook.red-bean.com/en/1.8/svn.advanced.props.special.ignore.htmlabout half way down.

要忽略 subversion 中的文件,您需要设置 svn:ignore 属性。你可以在这里看到更多http://svnbook.red-bean.com/en/1.8/svn.advanced.props.special.ignore.html大约一半。

To ignore the target folder from your project folder run

要忽略项目文件夹中的目标文件夹,请运行

svn propset svn:ignore target .

Alternatively to edit a list of ignored files folders run

或者编辑被忽略的文件夹列表运行

svn propedit svn:ignore .

回答by Alex DiCarlo

Use svn propset:

使用svn propset

svn propset svn:ignore directory .

回答by Roman C

Before committing code to the Subversion repository we always set the svn:ignore property on the directory to prevent some files and directories to be checked in. We always exclude the IDE project files and the target/ directory. Instead of keeping all of the excludes in mind all the time it's useful to put them all in a file and reference the file with the -F option:

在将代码提交到 Subversion 存储库之前,我们始终在目录上设置 svn:ignore 属性以防止签入某些文件和目录。我们始终排除 IDE 项目文件和 target/ 目录。与其始终牢记所有排除项,不如将它们全部放在一个文件中并使用 -F 选项引用该文件:

svn propset svn:ignore -F .svnignore .

Put this file in the project folder

将此文件放在项目文件夹中

.svnignore
target/*

回答by Geln Yang

I find a simple way that you can add it to svn:ignore in eclipse IDE after adding the target folder to revision and then restoring it.

我找到了一种简单的方法,您可以在将目标文件夹添加到修订版然后将其恢复后,将其添加到 Eclipse IDE 中的 svn:ignore。