How do I remove a file from svn versioning without deleting it from every working copy?

后端 未结 4 2238
别跟我提以往
别跟我提以往 2020-12-15 17:09

My situation is that a bunch of files are checked into svn which are very annoying to have under source control (specifically a log4j.properties file), and I wo

4条回答
  •  一生所求
    2020-12-15 17:24

    If you really have a lot of such files, you can kill two birds with one stone by using a svndumpfilter operation. The idea is to make a dump of the repository on the server, filter out files you don't want to keep, and load the result in a new repository. Then you put the new one instead of the old one.

    This has to be done with care, when users don't access the repository obviously. But it will actually remove the files (interesting when they are big) instead of keeping them in the history. As a side-effect, the next time a user does an update, these files will be ignored as if they were never in the repository. We had to do that a few times to remove binaries that didn't have their place there.

    Link to the related documentation.

    Simple example (the command offers more flexibility of course):

    svnadmin create repos_new
    svnadmin dump repos | svndumpfilter exclude trunk/log4j.properties | svnadmin load repos_new
    

    Since it touches to the repository on the server, I want to emphasize again that you should take precautions (keep your old repository). For not-so-annoying files the method proposed by Don is less drastic and preferable.

    To avoid this kind of situation, you can set the corresponding svn:ignore properties in the directories, you can also encourage people to use global ignores (they have to be set on each client unfortunately), or even use the hook-scripts to preemptively refuse categories of files.

提交回复
热议问题