开发者

How to svn ignore a file already added to the repository?

how can I ignore a file already add开发者_如何学Pythoned to a svn repository?

I like to exclude the file config.php:

$ svn st
M      .
M       config.php
M       adminfunctions.php

So, I use:

$ svn propedit svn:ignore .

And added config.php to the list.

Then, if I do another svn st, I get the same of the first time:

$ svn st
    M      .
    M       config.php
    M       adminfunctions.php

Wouldn´t the config.php be excluded just now?

Thanks in advance!


svn:ignore only affects files that have not been added yet.

So in your case you have to delete the files from repository with svn del — don't forget to copy them temporarily to another location). After you copy the files back into the original directory svn will not mark them as new (and try to add them).

EDIT: Alternatively, as commented by @Blake, you can use --keep-local option when you do a svn del instead of copying files to another location.


Here's an issue I encountered and the solution hoping it would be useful to someone.

Let's say you have 'a,b,c' files in the directory 'D'.

You svn remove the 'a,b,c' files from your working copy and add the 'svn:ignore *' property/value to the 'D' directory and commit those changes as the revision 1234. After that if you put back the same 'a,b,c' files in this directory 'D' on your working copy then svn will still consider the 'a,b,c' files as unversionned.

To fix this:

  • Keep a backup of your 'a,b,c' files somewhere and delete those in the 'D' directory of your working copy.
  • Update to the revision just before the 1234 one on your directory 'D'. That will pull back 'a,b,c' files from the repository to your working copy.
  • Then update to HEAD revision on your directory 'D'.
  • That will remove 'a,b,c' from the directory 'D' on your working copy.
  • Finally put back the 'a,b,c' files in the directory 'D' of your working copy.

Now 'a,b,c' are seen as ignored by svn.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜