About
A ref (or reference) is a human-readable name given to a commit SHA-1 hash.
When referring to a Git commit, you can refer it by name with a reference
A Git reference can be rewritten to point to a new commit.
Refs are:
There is also symbolic refs (alias ref) point to a ref instead of directly pointing to a commit, the most common being HEAD
Ref to a SHA commit
All SHA commit are in file located under the directory git dir/refs
Example for a head
cat .git/refs/heads/main
db393705d7bb3b8a1c155976082c6ee5691e678e
Remote Heads Refs
remote head refs
git ls-remote --heads remote
# default
git ls-remote --heads origin
dd39a644a4a7ec3e65135baaf48acd5f7f628510 refs/heads/master
6ead0945771dfd789aa97442ff10872f9665598d refs/heads/stable
e245797039fa7b86c3a3fb32b45cfb998d8c76cd refs/heads/v1.13
Git Repo
Physically, it's is a file under the refs directory in the repository directory that contains the commit hash.
Pull request
For Pull request such as Github Pull request, the ref value would be refs/pull/421/merge.