Friday, July 21, 2006

Subverting Subversion

Background: I committed a whole lot of files to an svn repository, then realised I really didn't want them there at all, and wanted to roll back the whole repository to before the commit happened. I couldn't find an easy way to do this - but here's an effective if nasty little hack, which will work if you have a working copy elsewhere representing the state you want to get the repository back to.

1. Make a temp dir, and copy your working copy to it.
2. Remove all the svn meta-information (found this here)

find . -name .svn -print0 | xargs -0 rm -rf

3. Check out the project from the repository, and copy all the files from your temp dir into the new project dir
4. Commit all the changes

The repository should be back to before your unwanted changes.

I'm hoping someone comes up with the 'right' way to do this, but for now I'm posting to avoid needing to figure it out again the next time.




0 Comments:

Post a Comment

<< Home