gitによるprojectの巻き戻し

手元の開発iPhoneゲームではプロジェクトにバージョン管理ツールとして git を導入 していました。 個人の開発ではチーム開発のように分担してブランチしたりマージしたりと言うような使い方は余りしませんが 試行錯誤を重ねる内に二進も三進も行かなくなったプロジェクトを 自身確定を認識している時点まで巻き戻すに実に有用だと考えます。

ゆめ応援プラザブログ村差し入れのパンと紅茶で小休止

参考になったのはサイト Exception Code. の2013年9月1日の以下の記事です。

スポンサーリンク
日付:2014年4月10日
開発機:MacBook Air(11-inch, Mid 2013)
MacOSバージョン:OS X 10.9.2
Xcodeバージョン:5.1
言語:Objective-C
主関連アプリ:uPanda Breaks Out Fruits
[XCode]gitでcommitしたファイル(リモートリポジトリ)を巻き戻す方法

手順として先ずはXcodeでプロジェクトを開き Soource Control から History を見ます。 巻き戻したい commit を見つけ出したら右上の表示される git ID をコピーします。 今回は 37dad4824de4 でした。 あとはターミナル操作になりますが該当ログを以下に記し置きましょう。

$ cd /Documents/iPhoneApps/uPanda\ Breaks\ Out\ Fruits/.git
$ cd ../
$ ls
GameOverScene.h    Break OutTests
GameOverScene.m    Podfile
ViewController.h    Pods
ViewController.m    uPanda Breaks Out Fruits.xcodeproj
Break Out        uPanda Breaks Out Fruits.xcworkspace
$ git checkout -f 37dad4824de4
Note: checking out '37dad4824de4'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at 37dad48... ゲームオーバー画面に於けるぱらぱらアニメの分岐表示
$

どうやら上手く機能してくれ 二進も三進も行かなくなった作業はないものとなり プロジェクトを認識把握している箇所から作業をやり直せました。

uPanda Breaks Out Fruits
無料:カテゴリ: ゲーム: 4+ 評価
バージョン: 4.12
リリース: 2014年9月15日
更新: 2022年4月20日
サイズ : 10.7 MB
互換性: iOS 14.4 以降のiPhone、iPod touch に対応。および、macOS 11.0以降とApple M1 チップを搭載したMac に対応。