Interview Prep/Git & GitHub/Git internals: objects, refs and the index

What is a packed ref and why does `packed-refs` exist?

IntermediateConceptGit internals: objects, refs and the index
Answer

Thousands of tiny ref files are slow on some filesystems, so git pack-refs (run by gc) moves them into the single .git/packed-refs file. A loose ref file, when present, overrides the packed entry. Newer Git also supports the reftable backend, which stores refs in a compact binary format for large repos.

git pack-refs --all
git init --ref-format=reftable demo
All Git & GitHub questions Roadmap: Git & GitHub

More on Git internals: objects, refs and the index