LoginSignup
22
18

More than 5 years have passed since last update.

間違えてgit reset --hardしてしまった場合の対処法

Posted at

git reflogで操作ログ的なのを参照できるので、それに対してgit reset --hardで戻す

# reflog確認
% git reflog                                                                                                                                          e597fa9 HEAD@{0}: reset: moving to e597fa9
6af4454 HEAD@{1}: commit: 戻したいコミット

# 戻したいコミットに戻す
% git reset --hard 6af4454
22
18
3

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
22
18