I'm new to working on a Mac and have had Time Machine backing up to an external HDD since I started using my MBP recently.

Today I wanted to get the code from a previous version of a file and managed to go back a few days, find the file in question, open it and find the method I wanted to copy.

However, no matter what I did I couldn't copy, cut, edit or otherwise save a version of the method. I didn't click 'Restore' as I didn't want to restore either the file or the entire mac back to that date.

In the top right of the viewing window was an 'Open in Xcode' button that did nothing.

In the end I resorted to taking a photo of my screen so I could remember the method details!

What am I doing wrong, how can I copy from a file in Time Machine, or otherwise grab from one file without having to do a big restore?

Thanks.

有帮助吗?

解决方案

If you just want one file (or a few files) then probably the easiest way is to go into Terminal and copy it directly, e.g.

$ cd /Volumes/Time\ Machine/Backups.backupdb/Your_Mac_name/Date_time_stamp/path
$ cp -p my_file.m ~/Desktop/

Relying on Time Machine for this kind if thing though is probably not the best idea - consider using proper source control such as git - it's very easy to set up and very easy to use and it will save you a lot of grief in the long run.

其他提示

It is completely safe to restore from Time Machine using the UI. When you click Restore you are given the option of keeping both files.

This is easy to check for yourself. Make a test area, put a file in it. Do a manual time machine backup, change that file. Now do a restore.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top