Archive for January, 2010

Finding or viewing a deleted file in SubVersion (SVN)

Yes it does happen that sometimes a file is deleted either inadvertently or on purpose and you either need to get it back or you just want to see what was there.

Since I keep forgetting on how to do this I thought I’d write it down.

The first step to recovering the file is to find the version in which it existed; to do so either go go to the directory it was in (or as close as you can get to the directory it was in) and run:

svn log –verbose

Note the revision of the file you are looking for.

If you want to restore your file to your current source tree then issue an

svn up -r [revision number] filename

If you just want to look at it then just go to any temporary folder and issue an

svn export -r [revision number] repository path (in the form of http://../filename)

Not that for the export notation you could use the parent folder name to get all the files in that folder at the same time.


Comments