为什么我的Git仓库进入独立HEAD状态? [英] Why did my Git repo enter a detached HEAD state?
问题描述
我今天结束了一个孤立的头,同样的问题,如下所述:
I ended up with a detached head today, the same problem as described in: git push says everything up-to-date even though I have local changes
As far as I know I didn't do anything out of the ordinary, just commits and pushes from my local repo.
So how did I end up with a detached HEAD
?
Any checkout of a commit that is not the name of one of your branches will get you a detached HEAD. A SHA1 which represents the tip of a branch would still gives a detached HEAD. Only a checkout of a local branch name avoids that mode.
See committing with a detached HEAD
When HEAD is detached, commits work like normal, except no named branch gets updated. (You can think of this as an anonymous branch.)
For example, if you checkout a "remote branch" without tracking it first, you can end up with a detached HEAD.
See git: switch branch without detaching head
这篇关于为什么我的Git仓库进入独立HEAD状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!