How are the terms “HEAD”, “head”, and “tip” different?

后端 未结 1 594
-上瘾入骨i
-上瘾入骨i 2021-01-22 09:01

Initial Understanding

HEAD

  • \"indicates the head of the current branch.\"
  • so, there is only one HEAD.

head

1条回答
  •  抹茶落季
    2021-01-22 09:16

    Branches (a.k.a. branch heads) mark points of interests in your repo. The metaphor isn't perfect, but you can think of branches as some sort of "bookmarks". Each branch points to a commit; that commit is called the tip of the branch.

    HEAD (note the uppercase) is different. It usually points to a branch, indicating which point of interest in your repo you're currently at. However, in some cases, HEAD may also point directly to a commit (in which case your repo is said to have a "detached HEAD").

    You can think of HEAD as

    1. a "you-are-here" marker on the metro map that is your commit graph; or
    2. an indicator of which branch (if any) is currently checked out.

    For instance, in the following repository, the tip of the master branch is the commit of abbreviated ID f42c5; the tip of the develop branch is the commit of abbreviated ID 190a3; HEAD points to master, indicating that master is currently checked out.

    enter image description here

    0 讨论(0)
提交回复
热议问题