从 Mac OS X Lion Time Machine 获取代码文件

发布于 2024-12-13 17:43:31 字数 350 浏览 3 评论 0原文

我是 Mac 工作新手,自从最近开始使用 MBP 以来,我已经将 Time Machine 备份到外部 HDD。

今天,我想从文件的先前版本中获取代码,并设法返回几天,找到有问题的文件,打开它并找到我想要复制的方法。

然而,无论我做什么,我都无法复制、剪切、编辑或以其他方式保存该方法的版本。我没有单击“恢复”,因为我不想将文件或整个 Mac 恢复到该日期。

查看窗口的右上角有一个“在 Xcode 中打开”按钮,但没有执行任何操作。

最后我拍了一张屏幕照片,这样我就可以记住方法细节!

我做错了什么,如何从时间机器中的文件复制,或者以其他方式从一个文件中抓取,而无需进行大量恢复?

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梨涡少年 2024-12-20 17:43:31

如果您只想要一个文件(或几个文件),那么最简单的方法可能是进入终端并直接复制它,例如,

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

如果这可能不是最好的主意,则依赖时间机器 - 考虑使用适当的源代码控制例如 git - 它非常容易设置和使用,从长远来看,它会为您省去很多麻烦。

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.

忆依然 2024-12-20 17:43:31

使用 UI 从 Time Machine 恢复是完全安全的。当您单击“恢复”时,您可以选择保留这两个文件。

这很容易自己检查。创建一个测试区域,在其中放入一个文件。进行手动时间机器备份,更改该文件。现在进行恢复。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文