简体   繁体   English

git存储库:可以在Xcode外部访问以前的文件版本

[英]git Repository: Is Previous File Version Accessible Outside of Xcode

With a git repository setup for my iPhone app, is there a way to gain access to the last committed version of a file outside of XCode? 通过为我的iPhone应用程序设置git存储库,是否有办法获得对XCode外部文件的最后提交版本的访问? Can I find the previous version somewhere on the hard drive, or perhaps piece the file together somehow? 我可以在硬盘上的某个位置找到以前的版本,还是以某种方式将文件拼凑在一起? The current version of the file is now corrupt (see story below for how this happened if interested), and I'd very much like to retrieve the changes I made since the last time I was able to backup the files outside of git. 该文件的当前版本现已损坏(如果感兴趣,请参见下面的故事,了解如何发生),我非常想检索自上次能够在git之外备份文件以来所做的更改。 I don't have the ability to access anything in XCode or run anything on the Mac outside of what's available through Max OS X Installer, so I'd like to access the previous version of the file if that is possible. 我无法通过Max OS X Installer访问XCode中的任何内容,也无法在Mac上运行任何内容,因此,如果可能的话,我想访问该文件的先前版本。

Story that pisses me off begins here:

On a recent 6 hour flight, I took my MAC with me on the plane, committing changes to the git about 2 times during this period. 在最近的6个小时的飞行中,我将我的MAC带到飞机上,在此期间约两次对git进行了更改。 Everything functioned fine on the MAC all the way until we had to shut down all electronics at the end of the flight. 在MAC上一切正常,直到我们在飞行结束时必须关闭所有电子设备为止。 At that time, I told the MAC to shutdown, but it froze instead. 那时,我告诉MAC关闭,但是它冻结了。 Wanting to avoid an airline incident, I forced the computer to shutdown by holding the power button after waiting for over a minute. 为了避免发生航空事故,我在等待一分钟后通过按住电源按钮来强制关闭计算机。

When I turned on the computer later that night, it would no longer boot, instead freezing on the Apple logo and the spinning gear. 当晚晚些时候打开计算机时,它将无法启动,而是冻结在Apple徽标和旋转的齿轮上。 I used my install disk to bypass logging in and accessed Disk Utility, which proceeded to FAIL repairing my drive. 我使用安装磁盘绕过登录并访问了磁盘工具,该工具无法修复驱动器。 The hard drive still mounts, so I'm able to get into my files. 硬盘驱动器仍在挂载,因此我可以进入文件。 I accessed the absolutely essential file needed for my app, and when I opened it on my Windows machine it contained garbage. 我访问了应用程序所需的绝对必要文件,并且在Windows计算机上打开该文件时,其中包含垃圾。 Of course most of the other files were all fine :-/ 当然,其他大多数文件都很好:-/

Story that pisses me off ends here.

So, I'm still trying to fix my stupid MAC, but before proceeding and possibly needing to wipe the drive, I'm trying to grab all the files I can, so any help is definitely appreciated. 因此,我仍在尝试修复愚蠢的MAC,但是在继续执行并可能需要擦除驱动器之前,我正在尝试获取所有可以捕获的文件,因此,我们非常感谢您的帮助。

To wipe out the current changes and see the most recent committed version, 要清除当前更改并查看最新的提交版本,

git checkout HEAD .

To wipe out the current changes and see the previous committed version, 要清除当前更改并查看以前的提交版本,

git checkout HEAD^ .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM