0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

git reset --hardメモ

Posted at

Git reset

バージョンを切り替えて比較デバッグすることが良くあると思います。
そんなときによくreset --hardを使います。
その時使用するコマンドのメモ書きです。

ログを表示

git reflog

結果

68ae43a (HEAD -> master) HEAD@{0}: commit: Ver.0.4.2
7a44b39 HEAD@{1}: commit: Ver.0.4.1
6d29c98 HEAD@{2}: commit (initial): Ver.0.4.0

先頭のハッシュ値を使います。

git reset --hard 7a44b39

バージョンを行ったり来たりしていると、reflog結果がごちゃごちゃしてくるので、
最新のハッシュ値を見つけるのは一苦労。

そこで最新のバージョンに戻すには、

git reset --hard ORIG_HEAD
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?