Mr. Boy
Mr. Boy

Reputation: 63720

Delete dir/files from SVN remote repo without causing local non-versioned copy to be deleted

This question deals with the question of "un-versioning" local files/directories so you keep them locally but they are removed from the remote repo. I have somewhat the opposite problem - another developer committed some XCode project directories which should be per-user. I can't checkout this dir locally because I already have a local non-versioned. And if I delete them from the repo directly, I'm worried that both of our local copies will be deleted when we update.

To summarise: - Developer and I both have a local folder containing several files - Developer committed his dir to SVN - Developer's working copy contains versioned - my working copy contains non-versioned and won't let me update

What is the best route here under two circumstances:

  1. The developer is avaialble to help fix things
  2. I have to do everything and try not to break the developer's working copy

Thanks! We are using a SVN 1.6 repository.

Upvotes: 3

Views: 4462

Answers (1)

David W.
David W.

Reputation: 107040

You can remove files remotely without checking out a particular working copy:

 $ svn rm -m "Removing user property" http://repo/svn/project/.userprops

However, you can always checkout a new working directory elsewhere on your computer and do your removal from there. I recommend this method because it allows you to check and verify what you're doing before committing changes. Plus, you can undo a bad revision by doing a reverse merge.

Suppose the revision with these wrongly added per-user files is revision 43210:

$ mkdir temp
$ cd temp                # New clean directory for new clean checkout
$ svn co http://repos/svn/project/trunk project-trunk
$ cd project-trunk
$ svn merge -c -43210    # Removes the bad revision
$ svn commit -m"Reversing revision 43210 because of bad pre-user files added"

And that's it.

By the way, I have a pre-commit hook that will prevent this from happening again. You can simply configure it not to allow users to add and commit these per-user files in your project.

Upvotes: 8

Related Questions