We’ve all done it. Spent hours working on some changes to a website, then saved over the top of them and not been able to undo far enough to get back to where we were. It’s a sickening feeling.
However if you use Subversion (SVN) you can easily roll-back to previously committed versions and avoid some of the pain. Subversion clients are 10 a penny, and some like Versions for OS X are a real work of art. However, I use Netbeans as my IDE of choice and it comes with pretty good SVN integration. There’s a nice tutorial available here.
If you find you’ve commited to the wrong Repository or Folder, trashes the .snv folder inside the project from the Terminal with:
find ./ -name '.svn' | xargs rm -Rf
If you want to know what folders are in a Repository, use:
svn list --verbose file:///path to repository
And if you created a Project with the wrong name, you can clean up with
svn delete -m 'Message here' file:///path to repository/branch to delete