Subversion: Restore deleted files
Posted: - Modified: | developmentIf you accidentally delete a file and then commit the change, you can retrieve the file along with the rest of the history by using svn copy to copy it into your working directory. svn copy -r revision-number your-full-repository-path-to-the-file file
UPDATE: pgier suggested svn copy http://svn/url/to/file@revision-number file
7 comments
Chris MacGregor
2009-12-17T07:18:15ZThanks, pgier - that syntax (copied below) worked for me, too:
svn copy http://svn.mycomp.org/repos... MyFile.java
(The -r syntax didn't work, nor did specifying the file without the full path to the repo.)
I'm using svn 1.5.6 - I'm guessing that the -r syntax works in some other svn version (probably older).
Sacha Chua
2009-12-17T08:08:20ZNoted and updated in the blog post. Thanks! =)
Chaya
2009-12-23T10:21:28ZI have deleted the file in SVN in user local system, but it has got deleted in the Main repository also. How can i recover the same.
Please help its a critical data.
Regards,
Chaya
Sacha Chua
2009-12-24T03:04:40ZHow did it get deleted? Try the svn copy command above.
Shiv
2010-02-20T07:06:11ZDo you happen to know if there's a difference between doing it the way you proposed versus using TortoiseSVN right-click feature as mentioned here?
http://tortoisesvn.net/most...
I tried the TSVN way, and it seemed to work for me. That is, all of the log history is still retained.
Sacha Chua
2010-02-20T07:34:48ZOh, I was on Linux, so I wasn't using TortoiseSVN. Glad that works for you! =)
vel
2010-04-15T15:18:49ZHi, my svn repository is in live.but Drive size 200GB is going to full.so i am added 500GB Hard disk in same system.How to move my svn repository one drive to another drive (ex:E drive to G drive).please help me,Thanks in advance,Vel