Thomas Clayson
Thomas Clayson

Reputation: 29925

Subversion - delete/clear and re-commit all files

So, basically, I've got a load of code that I want to add to subversion. The problem is that we have a repo for this project already, with old code in it.

Now I want to add my current code base to it - to "start again" as it were. I don't want to add source control to my current project because I don't want it to download the latest version of the old code.

So, I need to delete or clear my current repository, add source control to the folder with the new code in it and commit all those files.

How can I do this? I have ssh access to the server with subversion on it and am connecting (through Coda) using svn+ssh.

Thanks

ps: I couldn't figure out where was best to post this. Feel free to migrate to a better site if you think.

Upvotes: 3

Views: 4452

Answers (3)

user9876
user9876

Reputation: 11102

You can delete the contents of the existing repository without checking it out. From the command line, I'd first get a list of the files/directories at the root of your project:

svn ls svn+ssh://repourl/path/to/your/project/trunk

Then delete them (making sure to specify a log message):

svn rm -m "Delete old files" \
       svn+ssh://repourl/path/to/your/project/trunk/file1 \
       svn+ssh://repourl/path/to/your/project/trunk/file2 \
       svn+ssh://repourl/path/to/your/project/trunk/dir1 \

Or, alternatively, you can delete the main directory (traditionally called "trunk") and recreate it:

svn rm -m "Delete old files" svn+ssh://repourl/path/to/your/project/trunk
svn mkdir -m "Recreate trunk" svn+ssh://repourl/path/to/your/project/trunk

Either way, you'll end up with an empty trunk directory that you can check out quickly and add your files to.

Upvotes: 6

Xupypr MV
Xupypr MV

Reputation: 935

I can't imagine why you want do this, but if i want to solve this problem i will use SmartSVN for :

  1. Delete folder with old project (Repository -> Open in Repository Browser).
  2. Import to repository new version (Project -> Import Into Repository).

Upvotes: 0

Anton Gogolev
Anton Gogolev

Reputation: 115731

Move old code to a legacy branch, delete everything from trunk and import code there.

Upvotes: 0

Related Questions