What is HEAD?
BeginnerConceptGit internals: objects, refs and the index
Answer
HEAD is a reference to your current position, normally a symbolic ref pointing at a branch such as ref: refs/heads/main. When you commit, Git creates the commit and advances the branch HEAD points to. git switch rewrites HEAD to point at another branch.
cat .git/HEAD
git symbolic-ref HEAD
More on Git internals: objects, refs and the index
What are the four object types in Git's object database?BeginnerIs Git a snapshot system or a diff system?BeginnerWhat is the SHA-1 (or SHA-256) hash of an object and how is it computed?BeginnerWhere does Git store objects on disk, and what are loose objects versus packfiles?IntermediateWhat exactly is a branch, and what does creating one cost?IntermediateWhat is a detached HEAD and how do you recover work done in it?Intermediate