如何将.m文件还原/恢复到以前的版本? (错误地自动保存空白,xcode崩溃-没有源代码管理,没有Time Machine) [英] How to revert/recover .m file to a previous version? (autosaved blank by mistake and xcode crashed - no Source Control, no Time Machine)

查看:326
本文介绍了如何将.m文件还原/恢复到以前的版本? (错误地自动保存空白,xcode崩溃-没有源代码管理,没有Time Machine)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图寻找答案,但是我不能精确地定义术语,而不会一直陷入错误的线程中.

I've tried to search for the answer but I cannot precisely define the terms without falling under wrong threads all the time.

发生了什么事: 偶然地,我选择了 file.m 中的所有代码并将其全部删除. 它成为完整的空白文档.当我按Ctrl + Z撤消操作时, xcode崩溃了.

What happened: Accidentally I've selected all the code inside a file.m and deleted it all. It became a full blank document. When I pressed Ctrl+Z to UNDO it, the xcode crashed.

问题: 当我重新打开xcode(崩溃后)时,文件仍然全部空白(崩溃前几秒钟自动保存为空白文件)-全部丢失我的代码. 我无法使用UNDO 对此进行救助,因为它已自动保存并崩溃.

The problem: When I reopened the xcode (after the crash) , the file was still all blank (It was autosaved seconds before the crash as a blank document) - losing all my code. I could not use UNDO to rescue me on this because it autosaved and crash.

我需要什么: 有没有办法在自动保存/崩溃之前将文件恢复/还原到以前的状态?

What do I need: Is there a way to recover/revert my file to a previous state before this autosaving/crash?

其他信息: 源代码控制:我无法使用它,因为最后一次提交"是6月27日.

Extra information: Source Control: I can't use it because the last "commit" was June 27.

Time Machine:没有外部HD可以使用它.它被禁用.

Time Machine: Don't have external HD to use it. It is disabled.

更新1:我按下了放弃最后更改"按钮,并且file.m恢复为6月27日保存的文件. 因此,还有一个问题:直到现在都失去了所有的工作.

Updated 1: I've pressed the button "discard last change" and the file.m reverted to the file saved June 27. So, one more problem: Lose all the months of work up until now.

更新2:我找到了解决方法,并在下面发布.但是我需要等到明天才能接受它作为答案.

Update 2: I've found the solution, and posted below. But I need to wait until tomorrow to accept it as answer.

更新3:我对文本进行了重新编辑以阐明我的问题.

Update 3: I've reedited the text to clarify my problem.

推荐答案

哦!我修理它. 我已经使用 TextEdit 打开了 file.m . 然后,我浏览到: 文件>恢复为>浏览所有版本

Oh! I fix it. I've opened the file.m with TextEdit. Then I browse to: File > Revert To> Browse All Versions

它把我带到了一个保存了所有文件版本的地方,在这里我可以使用时间轴搜索所需的确切时间.

It led me to a place with all saved versions of the file, where I could search with a timeline the exact moment I need.

我已经找到了空白/崩溃时刻之前的版本,并复制了文本,将其粘贴到xcode上的file.m中(也已保存,将其提交给源代码管理以确保安全),现在一切正常.我可以再次恢复所有代码.

I've find the version previous to the blank/crash moment, and copied the text, paste it at file.m on xcode( also saved, commit it to source control for safety) and everything is ok now. I could recover all my code again.

这篇关于如何将.m文件还原/恢复到以前的版本? (错误地自动保存空白,xcode崩溃-没有源代码管理,没有Time Machine)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆