What is HEAD in Git?

后端 未结 22 2455
野的像风
野的像风 2020-11-22 10:02

You see the Git documentation saying things like

The branch must be fully merged in HEAD.

But what is Git HEAD exac

22条回答
  •  时光说笑
    2020-11-22 10:49

    Git is all about commits.
    And Head points to the commit which you currently checked out.

    $ git cat-file -t HEAD
    commit
    

    Whenever you checkout a branch, the HEAD points to the latest commit on that branch. Contents of HEAD can checked as below (for master branch):

    $ cat .git/refs/heads/master
      b089141cc8a7d89d606b2f7c15bfdc48640a8e25
    

提交回复
热议问题