git ある特定の commit のみ取り消す。

例えばgit logでこんな感じのとき
update jsだけを取り消したい。

commit 87d3f94be414802fe94e1c2c886596ecd26f3f2b
Author: Junichi Otake <@gmail.com>
Date: Mon May 27 15:22:06 2013 +0900

delete new items !

commit d5d366f6a9be5a9a0657231b048f206ccd0fd72d
Author: Junichi Otake <@gmail.com>
Date: Thu May 23 14:56:59 2013 +0900

update js

commit ae27735597e927982d39c95e7d49244c8335bcd7
Author: Junichi Otake
Date: Wed May 22 18:41:21 2013 +0900

add promoteBabyGrowth

ログの詳細を確認

git log –stat で変更ファイルを確認

commit d5d366f6a9be5a9a0657231b048f206ccd0fd72d
Author: Junichi Otake <@gmail.com>
Date: Thu May 23 14:56:59 2013 +0900

update js

scripts/manage/check_user.php | 9 +++-
web/sp/js/game_mid.js | 141 +++++++++++++++++++++++++++++++++++++—-
web/sp/js/game_prod.js | 118 ++++++++++++++++++—————-

3 files changed, 199 insertions(+), 69 deletions(-)

commit ae27735597e927982d39c95e7d49244c8335bcd7

update js以降に別の更新をしているならマージなどが必要
とりあえず、下のcommitのハッシュまで対象ファイルを戻すだけで良い場合は

git diff ae27735597e927982d39c95e7d49244c8335bcd7 web/sp/js/game_mid.js

で変更点を確認して問題なければ

git reset ae27735597e927982d39c95e7d49244c8335bcd7 web/sp/js/game_mid.js

git diff でまた変更を確認して問題なければ add して commit

This entry was posted on 月曜日, 5月 27th, 2013 at 10:06 AM and is filed under git. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Unityによるゲームを公開しております iOS/Android
https://itunes.apple.com/jp/app/lost-knight-3d-action/id900917032
https://play.google.com/store/apps/details?id=com.groundroad.runknight

各種開発支援・機能開発等小さいお仕事などもお請けしております。
unity開発支援, PHPシステム開発, javascript/html5 フロント開発, titanium mobileアプリ開発
お気軽にお問い合わせください
大崎・五反田近郊での対面でのお打ち合わせはいつでも可能です。