KcFnMi
KcFnMi

Reputation: 6171

HEAD detached at the HEAD commit id, what's the meaning?

git status says:

HEAD detached at e1997bd

and git rev-parse HEAD says:

e1997bd

What's the meaning of this?

I was thinking HEAD detached means HEAD is not pointing to to branch tip.

Upvotes: 11

Views: 8692

Answers (1)

Mircea
Mircea

Reputation: 10566

Read through: http://gitolite.com/detached-head.html

You can also look at: http://gitolite.com/gcs.html#(48)

The head points to the commit, that's not the problem. The problem is that it's no longer a reference to a local branch name. It's the actual SHA1 hash of the commit.

This may have happened if you did:

git checkout <commit_id>
  -- or --
git checkout origin/master

To fix this, do

git checkout <branch_name>

Upvotes: 18

Related Questions