- Directly refer to commits using SHA-1 hashes. Hashes are like unique IDs for commits. They can be accessed using
git log
- Refs are user-friendly aliases of commit hashes. It is another way of referencing commits
- Git uses refs to represent its internal branches and
repos tags
- Refs are stored as plain text files in
.git/refs/
depending on whether they represent branches, tags, or remotes. A given ref holds a commit hash
- The
heads/
directory contains all refs for local branches
- The
tags/
directory stores all refs for tags
- The
remotes/
directory contains a list of all remote repositories