LoginSignup
3
1

More than 5 years have passed since last update.

Gitで過去のバージョンに戻る方法~Git Bashから~

Posted at

はじめに

Gitで過去のバージョンに戻る方法を書いていきます。

どのバージョンに戻るか

git log オプション

を使っていきましょう。

特定の期間・件数のlogを見る

 git log --after="2016-03-15T00:00:00+0900" --before="2016-03-15T23:59:59+0900" 

このとき出てくるcommitのIDをコピーしましょう。
そして今自分がどのブランチにいるか確認しときましょう。(ここでは、hogehogeブランチにいるとします)

昔のバージョンに戻る

git checkout commitのID

これで戻ることができます。

昔のバージョンから帰ってくる

git checkout hogehoge
3
1
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
3
1