LoginSignup
1
0

More than 3 years have passed since last update.

[もう大丈夫]git コミットを消したあなたへ

Last updated at Posted at 2019-08-27

git reset --hard ハッシュ値 で特定のコミットまで戻る。

git reflog

shimizu@MyComputer1:/mnt/c/Users/81905/Desktop/chatplus$ git reflog
1857c8dfb (HEAD -> netseeds3_lang_change) HEAD@{0}: reset: moving to 1857c8dfb60fbacd25e1b34658775d1af7f4f063
2d7f571e6 HEAD@{1}: checkout: moving from netseeds3_text_change to netseeds3_lang_change
c85462328 HEAD@{2}: checkout: moving from netseeds3_lang_change to netseeds3_text_change
2d7f571e6 HEAD@{3}: checkout: moving from netseeds3_text_change to netseeds3_lang_change
c85462328 HEAD@{4}: checkout: moving from netseeds3_lang_change to netseeds3_text_change
2d7f571e6 HEAD@{5}: checkout: moving from netseeds3_text_change to netseeds3_lang_change
c85462328 HEAD@{6}: checkout: moving from netseeds3_lang_change to netseeds3_text_change

HEAD@{xx}というのは、過去何番目のHEADの状態を表す。
元に戻りたいポイントが分かれば、あとは、git reset --hardで強制的に巻き戻します。

git reset --hard HEAD{1}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0