git detached HEAD explained

来源:互联网 发布:Mac打不了大写英文字母 编辑:程序博客网 时间:2024/05/17 04:06

Git has something called a 'detached HEAD' that bears some explanation. Youare told 'do not commit on a detached HEAD', and it is not always clear whator why this is.

开始主要讲git的原理,讲HEAD指针。

反正,最重要的东西在最后:


git reflog show HEAD@{now} -10dcd215b... HEAD@{5 minutes ago}: commit (amend): 0-terminology: the malloc analogy added, plus5ce8bfe... HEAD@{11 minutes ago}: commit: 0-terminology: the malloc analogy added, plus3d93420... HEAD@{11 minutes ago}: rebase -i (pick): updating HEAD7fdae94... HEAD@{11 minutes ago}: checkout: moving from master to 7fdae94815d6c676742c9984132b7b9e71a57f983d93420... HEAD@{13 minutes ago}: rebase -i (squash): updating HEADc55900c... HEAD@{13 minutes ago}: rebase -i (pick): updating HEAD7fdae94... HEAD@{13 minutes ago}: checkout: moving from master to 7fdae94815d6c676742c9984132b7b9e71a57f98e9955c8... HEAD@{14 minutes ago}: commit: s97ab644... HEAD@{20 minutes ago}: commit: autogenc55900c... HEAD@{23 minutes ago}: commit (amend): 0-terminology: the malloc analogy added, plus

Now you look at this, decide which one you want, and grab it:

git branch thank_God_its_safe 7fdae94# like 'thank_God_its_safe = 0x7fdae94815d6c676742c9984132b7b9e71a57f98'git checkout thank_God_its_safe 
from:http://blog.csdn.net/raining_heart/article/details/8569904
原创粉丝点击