Take the 2-minute tour ×

I have a SVN project I'm working on that is entirely too messy, resources are named horribly, project files are full of erroneous information and links that are almost impossible to search and destroy. On top of that the file archives need serious rearranging to make any comprehensible sense. I committed it like this because I had every intention of fixing the problems with a NEW project named the same thing and only transferring over the 'Good' code and resources all in nice neat folders and directories.

So my problem is that I have a project "FOOBAR" that is all effed up. On my desktop I have "FOOBAR_FIXED" which is not under revision control but is what I now want on my 'FOOBAR' SVN.

How would I replace all of 'FOOBAR' with 'FOOBAR_FIXED'? Without having to manually delete all objects, committing, and then manually adding all objects again and recommitting?

share|improve this question
If files have been renamed etc and the new project complete in itself then why (essentially) merge the two file sets alongside each other? –  Grant Thomas Feb 13 '11 at 1:25

2 Answers 2

You describe it as another project, so it should probably be another project. But if you want to replace the current one, and really want to do it in one commit, instead of making your reorganization outside svn, you should have made a new branch of the trunk, made the changes there, and then copied/merged the cleaned branch back into the trunk. But now that you've done this, here's how I'd approach it.

  1. Export the trunk. (Not checkout. Export. We want a version without the svn tracking info.)

  2. Use a diff tool to diff the exported trunk and the fixed version of trunk and export the differences into a patch.

  3. Checkout the trunk. And apply the patch to the checked out version.

  4. Use svn status to find files the were completely deleted and use svn rm to record the deletions and files that were added, and use svn add to add them. (I believe the commands on a linux system would be svn status | grep "^!" | cut -f 2 | xargs svn rm to record the remove of old files, though I might have the parameters to cut wrong. I'll leave the version to add new files as an exercise, but it should old differ by one character and changing the "svn rm" to "svn add")

Hopefully this will work. You should definitely run any tests again to make sure everything is correct.

First deleting everything in trunk, and then checking in the entire new version, would be much easier.

share|improve this answer

If it's such a hopeless cause, just start a new repository, and keep the old one around for reference.

A half-way measure might be to rename trunk to trunk.bad and start a new trunk.

share|improve this answer

Your Answer


