What is HEAD in Git?

后端 未结 22 2016
野的像风
野的像风 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:40

    Take a look at Creating and playing with branches

    HEAD is actually a file whose contents determines where the HEAD variable refers:

    $ cat .git/HEAD
    ref: refs/heads/master
    $ cat .git/refs/heads/master
    35ede5c916f88d8ba5a9dd6afd69fcaf773f70ed
    

    In this repository, the contents of the HEAD file refers to a second file named refs/heads/master. The file refs/heads/master contains the hash of the most recent commit on the master branch.

    The result is HEAD points to the master branch commit from the .git/refs/heads/master file.

    enter image description here

提交回复
热议问题