Coder Merlin File Recovery
Uh-oh. What can you do if you accidentally deleted (or otherwise mangled) a file? If you're reading this page it's because you didn't backup your files and/or use source control properly. Before proceeding, make a mental note to never find yourself in this situation again and make the commitment to backup early and often and use git without fail. Also, never rely on magical tools to backup and restore your files; that's your responsibility. Nonetheless, since you're still reading, it seems that you have no better options, so here's how to use
Type oops on the bash command line:
You'll receive a brief description of the syntax:
oops! restores accidentally deleted or modified files USAGE: ls <filename> list available restore versions for the specified filename diff <filename> <version> diff current file version with the specified repository version cp <filename> <version> <targetFilename> cp specified repository version to targetFilename
oops relies on "snapshots" of your directory which are automatically saved periodically. To find a list of snapshots, use the "ls" (list) command specifying the filename. As an example, let's say you're in your project directory and accidentally deleted the file "main.swift". You can use the "ls" (list) command to obtain a list of available backups from the repository.
You'll receive a list of available backups. The first line is the file which is searched for in the repository. Subsequent lines, if any, list in reverse chronological order (newest first) the time of an available backup, the size (in bytes) of the backup, and a version identifier.
/home/john-williams/projects/oops/Sources/oops/main.swift 2019-03-14 18:10:52 15910 36076846 2019-03-13 22:25:51 15349 38067634 2019-03-13 21:44:28 14422 38067205 2019-03-13 20:24:42 14763 38066074 2019-03-13 19:59:24 12959 38065421 2019-03-12 19:42:00 12009 38097985 2019-03-11 23:59:58 9131 38070737 2019-03-10 21:28:39 1897 37830547
If you know which version you want to retrieve (perhaps it's just the most recent) you can execute the "cp" (copy) command specifying filename, version and restored filename. As an example, to retrieve the most recent version of the file main.swift:
/home/john-williams/projects/oops/Sources/oops/main.swift 36076846 -> /home/john-williams/projects/oops/Sources/oops/main.swift.restored
If you're not sure about which file to retrieve, you can use the diff command to compare the differences between the current file and the specified version. As an example, to compare the most recent version of the file main.swift:
You'll receive a diff listing the differences between the two files.