8

I didn't realize svn delete would delete my local copy, I just wanted it out of the repository. Now all my files are gone, and they aren't in the trash bin either. Is there any way I can recover them?


I should clarify, these files never made it into the repository. I was trying to get rid of some old junk in the repository so that I could check these in.

I'm running Ubuntu on an ext3 filesystem. It's okay though.... I managed to redo what I deleted in about 2 hours.

mpen
  • 272,448
  • 266
  • 850
  • 1,236
  • 1
    Ouch. Is there a backup that covered either the SVN repo or your local copy? Even accidentally? Can you get the disk blocks back with an undelete utility? Above all, try not to panic... – RBerteig Apr 14 '09 at 02:15
  • 2
    Hi Mark, just wanted to mention that I've just gone through the same problem, though I used `svn remove` which I thought wouldn't do the same as `svn delete`. There was even a message asking me if I really want to do this, but this message did not indicate that my files would be deleted locally. I think they should make that message more appropriate. – Lena Schimmel Dec 22 '09 at 19:54
  • 1
    @Brian: Yeah I know eh!? Terrible! – mpen Dec 23 '09 at 02:09
  • you can "always" recover deleted files on NTFS / FAT / ext3j there are a Lot of software out there that can help you with that. – Filip Ekberg Nov 26 '10 at 06:53

7 Answers7

3

Nope.

Not unless they're still in use by some other application, sorry.

user90052
  • 2,550
  • 3
  • 16
  • 7
  • Which brings into mind, does anyone else is on this project? They might have a copy. – Itay Moav -Malimovka Apr 14 '09 at 02:13
  • No, netbeans like to close files when they're deleted for some retarded reason... otherwise it would still been in memory. – mpen Apr 14 '09 at 02:16
  • Many IDE's tend to auto-reopen when they get foregrounded, this is mainly to help the development process along if a remote process modified part of a file so that you may continue working so that you don't get one version that is on disk and one version that is in memory. – X-Istence Apr 14 '09 at 16:21
  • @X: I understand that... if it was *modified* it might be a different story (with undo support), but to just close it without prompt? Not a clever design decision IMO. – mpen Dec 23 '09 at 02:13
1

Going to the file directory,

svn revert "filename"

will restore any file locally deleted, yet not committed, but already under version controlled.

karim
  • 15,408
  • 7
  • 58
  • 96
1

Can't you just check out whatever you were working again in a new directory? If you had any changes that were not versioned you are SOL, anything else you can just svn revert to the latest version in the repository.

X-Istence
  • 16,324
  • 6
  • 57
  • 74
  • Unfortunately not. I was trying to check them into the repository, but there were some conflicts with some older files sitting in the repository. I was trying to delete those so I could check in the new stuff... well this really blows. – mpen Apr 14 '09 at 02:17
  • 1
    this is exaclty the sort of thing that a DVCS helps with - you commit locally before you merge. guess you will have to put it down as experience – jk. Jan 28 '10 at 12:30
  • @jk. Took me awhile to wrap my head around DVCS, but I'm really enjoying it now. – mpen May 09 '12 at 20:47
0

You run command svn log and get the revision number of the unhappy deletion. then run svn merge -r2572:2571 svn://$PATH_WHERE_YOU_DELETED_NUMBER_WAS_ON_SVN_SERVER &LOCAL_PATH_WHERE_TO_SAVE_FILE

where -r are the revision numbers

example merge -r2572:2571 svn://www.jane16.com/var/opt/svn/mypoject/Start.java C:/ecplipse/workspace/myporject/Start.java

0

You have used 'svn delete' command and deleted local copy. It means original versions of files still exist in SVN history. 'svn delete' doesnot delete history of file from the repository. You can recover the last version in following way

  1. Check the SVN Log and find out the revision number of 'delete operation'.
  2. Use 'svn checkout' to check the revision just before the 'delete operation'. (e.g. if revision number of delete operation is 100, check out the revision number 99) svn checkout --revision
Nitin Bhide
  • 1,685
  • 14
  • 15
  • 1
    Local changes he made are not in the revision repo and thus he can't recover those. – X-Istence Apr 14 '09 at 16:21
  • just saw the comment "I should clarify, these files were never made it into the repository." Somehow didnot realize it when I wrote the answer – Nitin Bhide Apr 14 '09 at 17:19
0

Depending on your SVN client you should be able to get these files from a previous revision using "Show Log" as its called in Tortoise...

Just open the log find a revision where that file was still there and "revert to this revision"

dkarzon
  • 7,868
  • 9
  • 48
  • 61
0

If you're under windows, you can check the (partially) free tool name zero assumption recovery. Really helps when you deleted files on windows!

Or else if you have it enabled and you're using vista you can check the "previous versions" of your folder in the properties of it.

hope it helps! good luck.

attwad
  • 935
  • 8
  • 21