0

I recently installed Github for Mac. During the setup process I imported an existing Xcode project, which was open at the time. Upon doing that Xcode prompted an alert saying that the project had changed and asking if I wanted to re-save. I opted to resave because I thought the changes it was referring to was the fact that I had just added the project to git. I didn't think that the actual code files were changed in the process. Unfortunately what really happend is that the project reverted back to a version from late March, costing me about a month and a half of work.

Does anyone have any suggestions about how I can undo the damage I just caused? I can't figure out why it chose a date in March to revert to. Perhaps that was the last time I committed the code using Xcode's source control. There's a version in Time Machine that I can use to restore the project, but that is at least a couple of weeks old. Before doing that I was wondering if there's a better solution.

4

1 に答える 1

0

何が表示されているかを確認しgit logます。すべてのコミットが一覧表示されます。コミットがあれば、ソースコードをその時点まで復元できます。(たとえば、これを行うことができますgit reset --hard <committish>

(本当に奇妙なことをした場合は、git reflogによって表示されなくなったコミットを確認することもできますがgit log、そうではないようです。)

残念ながら、最後にコミットしたのは 3 月のようです。その場合、Time Machine が最適なオプションのようです。

于 2013-05-19T16:11:33.490 に答える