简体   繁体   English

如何使SVN忽略文件夹?

[英]How to make SVN ignore a folder?

I want to make SVN ignore everything that is in my wordpress directory. 我想让SVN忽略我的wordpress目录中的所有内容。 It bring me nothing but headaches because of auto updates to plugins etc. 由于插件的自动更新等,它给我带来的只是头痛。

When I... 当我...

svn propedit svn:ignore ./blog

It tells me... 告诉我...

svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR is set, and no 'editor-cmd' run-time configuration option was found svn:未设置任何环境变量SVN_EDITOR,VISUAL或EDITOR,并且未找到“ editor-cmd”运行时配置选项

So I... 所以我...

[phil@sessions www]$ export SVN_EDITOR=emacs
[phil@sessions www]$ svn propedit svn:ignore ./blog

But I don't know what to put in here to make it ignore. 但是我不知道在这里放什么来使其忽略。

To instruct Subversion to ignore a directory, you must edit the properties of the parent directory. 要指示Subversion忽略目录,必须编辑目录的属性。 So if blog is your Wordpress directory that you want to ignore, do: 因此,如果blog是您要忽略的Wordpress目录,请执行以下操作:

[phil@sessions www]$ svn propset svn:ignore blog .

The arguments of propset are PROPNAME , PROPVAL , and PATH . 的论据propsetPROPNAME,PROPVAL,路径 So this sets the svn:ignore property on . 因此,这svn:ignore属性设置为. (the current directory) to blog . (当前目录)到blog

Of course you may choose to use propedit instead of propset if you want to edit the existing value in an interactive editor. 当然,如果要在交互式编辑器中编辑现有值,则可以选择使用propedit代替propset

I am not sure but can you just delete the folder from SVN? 我不确定,但是您可以从SVN中删除文件夹吗?

svn --keep-local delete path/to/folder

This deletes it from SVN but keeps it in your working copy. 这将从SVN中删除它,但将其保留在您的工作副本中。

But I am not sure if the local copy stays with the next update and I guess this svn:ignore is a cleaner approach? 但是我不确定本地副本是否保留在下一个更新中,并且我猜这个svn:ignore是一种更干净的方法?

A lot of other questions have covered this ground already (search "[svn] ignore"; too lazy to link them all), but the key thing that isn't emphasized enough in the docs is that svn:ignore only applies to items that do not exist in the head version of the repo. 许多其他问题已经涵盖了这一领域(搜索“ [svn] ignore”;太懒了以至于无法将它们全部链接起来),但是文档中没有充分强调的关键是svn:ignore 适用于那些回购的头部版本中存在。 So if you want svn:ignore to apply to something that you've already (accidentally) checked in, you need to svn delete the item first, to get it out of the repo. 因此,如果您希望svn:ignore应用于已经(偶然)签入的内容,则需要先svn删除该项目,以使其脱离存储库。 See if that fixes your problem. 查看是否可以解决您的问题。

If you don't specify the property in command line, SVN will try to open your editor to let you modify attributes. 如果您未在命令行中指定属性,则SVN会尝试打开编辑器以允许您修改属性。

You can either: 您可以:

  • Specify the attribute on the command-line: 在命令行上指定属性:

    svn propset svn:ignore "*" ./blog svn propset svn:ignore“ *” ./博客

  • Export your editor name in SVN_EDITOR, and when svn opens your property list, just add patterns separated by new lines. 在SVN_EDITOR中导出您的编辑器名称,然后当svn打开属性列表时,只需添加用新行分隔的模式。

svn propedit svn:ignore ./some_path tells svn that you want to ignore things under the some_path directory. svn propedit svn:ignore ./some_path告诉svn您要忽略some_path目录下的some_path

For example if there are 2 files under ./some_path, and you wanted to ignore both, you could enter 例如,如果./some_path下有2个文件,而您想忽略这两个文件,则可以输入

foo
bar

If you want to ignore foo but not bar, just enter 如果要忽略foo而不是bar,只需输入

foo

Finally, it understands wildcards, so if you wanted to ignore everything under ./some_path, you could enter 最后,它了解通配符,因此,如果您想忽略./some_path下的所有内容,则可以输入

*

So, if you would like to ignore everything under ./blog, I think * should do the trick. 因此,如果您想忽略./blog下的所有内容,我认为*应该可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM