why does bare repository have HEAD

I’m wondering what’s the purpose of HEAD in bare repository? Is it just used when repository is cloned to know which branch to checkout in cloned repository?

Please note, this question is not about what is HEAD, but given its functions I’m wondering why it’s needed inside bare repository.

  • git deploying project - file permissions - (chmod)
  • Is it possible to clone git-p4 repo?
  • How to recover file after `git rm abc.c`?
  • Pushing to a remote branch (failed to update ref)
  • Git log, no commits that were reverted
  • How can i git pull with overwriting changes
  • How can I manually remove a blob object from a tree in Git?
  • Can you have multiple .gitignore files within a single repo?
  • Git Ignore not working, I don't get it
  • git diff branch --name-status --ignore
  • Differences between these methods of importing existing Git repositories into GitHub?
  • How to access git remote repo since IP address changed
  • One Solution collect form web for “why does bare repository have HEAD”

    Can you please name a case where HEAD is used in a bare repository?

    See “t/t1430-bad-ref-name.sh

    You can do a soft reset in a bare repo, which means you can move HEAD (current commit) around, which is one way to change the default branch.

    That means that when you clone a bare repo, the default branch checked out in the non-bare clone will be the one referenced by the bare repo HEAD.

    Git Baby is a git and github fan, let's start git clone.