Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why does bare repository have HEAD

Tags:

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.

like image 288
Max Koretskyi Avatar asked Mar 27 '15 08:03

Max Koretskyi


1 Answers

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.

like image 135
VonC Avatar answered Sep 18 '22 13:09

VonC