7
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 5 years have passed since last update.

gitで以前commitした時の状態に戻したい時

Last updated at Posted at 2018-12-02

git log コマンドでcommit id を調べる

以前のcommitした状態に戻すには、戻したいcommitのidを調べる必要がある。

git log

commit id をコピー。

git reset --hard [commit id]

以下のコマンドを実行。[commit id]は先ほどコピーしたものをペースト。

git reset --hard [commit id]

ローカルファイルの状態が、選んだcommitの状態に戻っているはず。

7
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
7
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?