branch

In Git, a movable name for one commit; committing on the branch moves the name forward to the new commit.

In more detail

A branch is a small file under .git/refs/heads holding one commit ID, so creating one copies no files and is instant even in a huge repository. Commits do not belong to a branch; a branch just marks where one line of work currently ends. When you commit, Git follows HEAD to the current branch and rewrites that file with the new ID.

Example

cat .git/refs/heads/main

Related terms

Taught in

References

Certification courses