1
2

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.

特定のcommit箇所まで強制復元する【git reset --hard】

Posted at

まず、戻したいcommitのハッシュ値を調べる。
(調べ方についてはコマンド操作よりVSCodeの拡張機能のGit Graphを使用する方がお手軽)

例えば1ae86e0c3320c2e375d5d505f80813a6f7ba8a55と言うcommitまで戻したい場合は、下記のようにする。

git reset --hard 1ae86e0c3320c2e375d5d505f80813a6f7ba8a55

--hardをつけると強制的にコマンドを実行する。

1
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?