Bus errorとSegmentation faultに困ったら見るブログ

物理の研究者による日々の研究生活のメモ書きです ( python/emacs/html/Japascript/シェルスクリプト/TeX/Mac/C言語/Linux/git/tmux/R/ポケモンGO)

【git】checkoutで過去に遡ったはいいが、戻り方を知らなかった人のための記事

そんなやつおる〜?(私です)

% git checkout hogehoge
Note: checking out 'hogehoge'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b

HEAD is now at hogehoge... foo

伏せ字ばっかりで申し訳ないですが、こんな感じで過去のコミットに遡ることができる
hogehogeというのはgitのコミットに割り当てられたID
fooはコミットメッセージ

こういう最新のHEADから切り離された状態をdetauched HEADというらしい


ここから、最新の状態に戻るためには

git checkout master

でOKらしい

危うくタイムマシーンに乗れないところだった・・・・・

ランキング参加中です

↓クリックしていただけると嬉しいです〜