Home

refsheads

Refsheads is not a formal term in Git; it is commonly shorthand for the refs/heads namespace, which stores local branch references. In Git, refs are lightweight pointers to commits, and they live in the repository under .git/refs. The local branch tips are kept in .git/refs/heads. Each file named after a local branch contains the commit hash of the tip of that branch. For example, .git/refs/heads/main would contain the SHA-1 of the commit at the tip of the main branch. If a branch name contains a slash, Git uses nested directories under .git/refs/heads.

When there are many refs, Git may store them in .git/packed-refs, a single file that maps ref

Remote-tracking branches use refs/remotes/<remote>/<branch>, separate from local refs. Creating, updating, or deleting a local branch updates

Common commands to interact with these refs include git branch, git checkout, git show-ref, and git update-ref.

Note: The standard terminology is refs/heads for local branches, not a separate feature called refsheads; "refsheads"

names
to
commit
SHAs
to
improve
performance
and
reduce
filesystem
overhead.
The
current
branch
is
tracked
by
HEAD,
which
usually
stores
a
symbolic
reference
to
refs/heads/<current-branch>.
If
HEAD
points
directly
to
a
commit,
the
repository
is
in
a
detached
HEAD
state.
the
corresponding
file
under
.git/refs/heads
or,
when
using
packed
refs,
the
update
applies
to
the
packed-refs
entry.
Although
users
typically
manipulate
branches
with
these
commands,
direct
editing
of
.git/refs
or
packed-refs
is
discouraged
unless
necessary.
is
likely
a
shorthand
or
misnomer
for
the
refs/heads
namespace.