News for hackers. Stuff that matters.
[dead]
Re:How HEAD works in Git by js2 on Friday March 08, 2024 @09:40PM (#39648980)
This adds confusion because it is not literally a symlink and it doesn't always act like a symlink either. It also assumes people understand the difference between a symbolic link and a hard link.

HEAD is a pointer. It points either indirectly to a commit through the name of a branch, or directly to a commit when you've checked out something other than a local branch (so called detached HEAD). In this way it acts both like a symlink and like a hard link. So:

HEAD -> branch name -> commit ID; or

HEAD -> commit ID.

Its literal representation is a file named HEAD whose contents are either the name of a branch or a commit ID.

A tag is also a pointer. It may also point either indirectly to a commit through an annotated tag object or directly to a commit (so called lightweight tag). So:

tag -> tag object -> commit ID; or

tag -> commit ID.

Its literal representation is a file under refs/tags named after the tag and whose contents are the ID of the tag or commit object.

(Ignoring optimizations such as packed refs and the exact formatting of ref files. See Git book and man pages for details, or poke around your local .git directory. It's very explorable.)

Re:How HEAD works in Git by patmorgan23 on Friday March 08, 2024 @09:35PM (#39648945)
Everything in Git is a symlink or a hash lol
Re:How HEAD works in Git by DiabloD3 on Friday March 08, 2024 @09:37PM (#39648967)
Yes, thats my point and the beauty of git.

I hope Linus is actually remembered for this more than the creation of Linux.

Re:How HEAD works in Git by Arubis on Friday March 08, 2024 @09:48PM (#39649021)
We’re getting there. I recently heard Linux described as “if the guy who designed Git made an operating system”.
Re:How HEAD works in Git by Espressosaurus on Friday March 08, 2024 @09:50PM (#39649028)
Linux isn't that bad