Hgta的博客

个人博客

svn ignore 命令行用法

Posted on | 9月 2, 2011 | No Comments

若想创建了一个文件夹,并且把它加入版本控制,但忽略文件夹中的所有文件的内容:
$ svn mkdir spool
$ svn add spool
$ svn commit -m “Adding ’spool’”
$ svn propset svn:ignore ‘*’ spool
$ svn ci -m ‘Adding “spool” and ignoring its contents.’

若想创建一个文件夹,但不加入版本控制,即忽略这个文件夹:
$ mkdir spool
$ svn propset svn:ignore ’spool’ .
$ svn ci -m ‘Ignoring a directory called “spool”.’

若已经创建了文件夹,并加入了版本控制,现在想忽略这个文件夹,但要保持文件夹的内容:
$ svn export spool spool-tmp
$ svn rm spool
$ svn ci -m ‘Removing inadvertently added directory “spool”.’
$ mv spool-tmp spool
$ svn propset svn:ignore ’spool’ .
$ svn ci -m ‘Ignoring a directory called “spool”.’

若要忽略文件夹里的某几个文件
$ svn mkdir spool
$ svn add spool
$ svn commit -m “Adding ’spool’”
gvim .svnignore
每种要忽略的文件加一行,如:
.svnignore
*.pyc
*.cash
test.php

然后
svn propset svn:ignore -F .svnignore .

svn status

 

http://www.lampblog.net/2010/08/svn-ignore-%E5%91%BD%E4%BB%A4%E8%A1%8C%E7%94%A8%E6%B3%95/

 

 

http://svnbook.red-bean.com/en/1.1/ch07s02.html#svn-ch-7-sect-2.3.3

So you have two options, depending on whether you want the spool
directory itself to be in version control and have its contents
ignored, or whether you want the directory itself ignored as well.

If you want the former, create the directory, add it, then set the
svn:ignore property of that directory to ‘*’ to ignore everything in it.

$ svn mkdir spool
$ svn propset svn:ignore ‘*’ spool
$ svn ci -m ‘Adding “spool” and ignoring its contents.’

If you want the latter, do not add the directory, but rather set the
svn:ignore property of the parent directory to ‘spool’.

$ mkdir spool
$ svn propset svn:ignore ‘spool’ .
$ svn ci -m ‘Ignoring a directory called “spool”.’

If you had already added the spool directory but now realize you did
not want to, but want to preserve its contents, you can fix it this way:

$ svn export spool spool-tmp
$ svn rm spool
$ svn ci -m ‘Removing inadvertently added directory “spool”.’
$ mv spool-tmp spool
$ svn propset svn:ignore ‘spool’ .
$ svn ci -m ‘Ignoring a directory called “spool”.’

 

 

http://svn.haxx.se/users/archive-2006-03/0225.shtml

Comments

Leave a Reply





About

博主 hgta

Search

Admin