Xcode:从快照中恢复完整的项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/929770/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode : Recover complete project from snapshot?
提问by TalkingCode
today I am playing a bit with the Xcode snapshot feature and I wonder if I could recreate a complete project from a snapshot if all code is lost.
今天我在玩 Xcode 快照功能,我想知道如果所有代码都丢失,我是否可以从快照重新创建一个完整的项目。
It seems to me in the Snapshot-Manager I can only see snapshots of the current project, not of all projects. So if my projectfile is lost or damaged is there anyway to recover my files from a snapshot?
在我看来,在快照管理器中我只能看到当前项目的快照,而不是所有项目的快照。因此,如果我的项目文件丢失或损坏,是否可以从快照中恢复我的文件?
I also wonder were the snapshots are saved. Not in the project folder I found out already.
我也想知道是否保存了快照。不在我已经发现的项目文件夹中。
回答by James Bedford
Go to the "Projects" tab in the Xcode Organizer and select your project. You should see all the snapshots that have been made. Select the snapshot you want to restore to and select "Export Snapshot" to save it somewhere to disk. What you export to disk is your "recovered" version of your project.
转到 Xcode 管理器中的“项目”选项卡并选择您的项目。您应该会看到所有已制作的快照。选择要恢复到的快照,然后选择“导出快照”将其保存到磁盘的某个位置。您导出到磁盘的是您项目的“恢复”版本。
I agree systems such as SVN and Git are far superior to Xcode's snapshot mechanism for version control. However, the snapshot mechanism can be very useful. For example, I just made a change to a project. Before making the change, Xcode asked me if I'd like to take a snapshot. After the change it turned out that I didn't want to make that change and so I used this mechanism to restore the project to the prior state.
我同意 SVN 和 Git 等系统远优于 Xcode 的版本控制快照机制。但是,快照机制非常有用。例如,我刚刚对一个项目进行了更改。在进行更改之前,Xcode 询问我是否要拍摄快照。更改后,结果证明我不想进行更改,因此我使用此机制将项目恢复到先前状态。
回答by mouviciel
Before trusting Xcode snaphot feature too much, may I suggest you to consider source code management with CVS, SVNor Perforce(integrated in Xcode)?
在过于相信 Xcode snaphot 功能之前,我是否建议您考虑使用CVS、SVN或Perforce(集成在 Xcode 中)进行源代码管理?
For me, the main usage of snapshot is during a refactoring session: You create a snapshot before applying refactoring changes, so that you are able to revert your modifications.
对我来说,快照的主要用途是在重构会话期间:在应用重构更改之前创建快照,以便您能够还原修改。
回答by Abizern
Have a look in your home folder:
查看您的主文件夹:
~/Library/Application Support/Developer/Shared/SnapshotRepository.sparseimage
Within this you'll find the project snapshots.
在此,您将找到项目快照。
But, you're better off using a proper source control system
但是,您最好使用适当的源代码控制系统
回答by user637338
Since there has been some remarks concerning version control systems. I would really advice to give git a chance. If you include the xcode specific files into the git repo, then you have the same effect as the snapshot mechanism.
因为有一些关于版本控制系统的评论。我真的建议给 git 一个机会。如果您将 xcode 特定文件包含到 git repo 中,那么您具有与快照机制相同的效果。
So if you have a project that is not git controlled at the moment you can just use one of these howtos to create a git repo:
因此,如果您目前有一个不受 git 控制的项目,您可以仅使用以下方法之一来创建 git 存储库:
Using Git with an existing XCode project
And then don't forget to add the .xcodeproj directory and things should be a bit smoother.
然后不要忘记添加 .xcodeproj 目录,事情应该会更顺畅一些。
I really dislike Linus Torwald at times, but git is just the best VCS I ever came across.
有时我真的不喜欢 Linus Torwald,但 git 只是我遇到过的最好的 VCS。
回答by RawMean
This document explains how snapshots are restored: http://developer.apple.com/library/ios/#documentation/IDEs/Conceptual/Xcode4TransitionGuide/SCM/SCM.html
本文档解释了如何恢复快照:http: //developer.apple.com/library/ios/#documentation/IDEs/Conceptual/Xcode4TransitionGuide/SCM/SCM.html