Branches as Pointers

Branches Are Just Movable Pointers

A branch is a file under refs/heads/ holding one commit hash (Refs and HEAD). It names its latest commit, the tip; the rest of the branch is whatever Git 1,932 reaches by following parent links back:

Creating a branch writes one 41-byte fileShell
git branch search-api
git branch -v
cat .git/refs/heads/search-api
git log --oneline --decorate -1
Output
* main       9004c2c Stop tracking personal editor settings
  search-api 9004c2c Stop tracking personal editor settings
9004c2c25f70e0c7e32d0ba2d8c2598c6a04ee8e
9004c2c (HEAD -> main, search-api) Stop tracking personal editor settings

* marks the branch HEAD names, and that is all "current" means: a new commit takes the current tip as its parent, and Git moves only that branch to it (4). A commit belongs to every branch that reaches it, so "which branch was it made on?" has no answer; git branch --contains <commit> lists those branches.