Expand description
Reference storage — files backend + reftable backend.
Git stores references as text files under <git-dir>/refs/ (and
<git-dir>/packed-refs for the packed backend). Each loose ref file
contains either:
- A 40-character hex SHA-1 followed by a newline, or
- The string
"ref: <target>\n"for symbolic refs.
HEAD is a special case: it is normally a symbolic ref but may also be
detached (pointing directly at a commit hash).
When extensions.refStorage = reftable, the reftable backend is used
instead. The public API is the same; dispatch is handled internally.
Enums§
- LogRefs
Config - Core
logAllRefUpdatesmodes (after config lookup), matching Git’slog_refs_config. - RawRef
Lookup - Outcome of a single storage-level ref lookup (Git
refs_read_raw_refstyle). - Ref
- A symbolic or direct reference.
Functions§
- append_
reflog - Write a reflog entry.
- common_
dir - Determine the common git directory for worktree-aware ref resolution.
- delete_
ref - Delete a ref.
- effective_
log_ refs_ config - Effective
logAllRefUpdatesafter applying Git’sLOG_REFS_UNSETrule. - list_
refs - List all refs under a given prefix (e.g.
"refs/heads/"). - list_
refs_ glob - List refs matching a glob pattern (e.g.
refs/heads/topic/*). - read_
head - Read the symbolic ref target of
HEAD. - read_
log_ refs_ config - Read
[core] logAllRefUpdatesfrom the repository config. - read_
raw_ ref - Return whether
refnameexists as a ref in the repository’s ref storage. - read_
ref_ file - Read a single reference file from
path. - read_
symbolic_ ref - Read symbolic target of any ref.
- ref_
matches_ glob - Check whether a ref name matches a glob pattern.
- resolve_
at_ n_ branch - Resolve
@{-N}syntax to the branch name (not an OID). Returns the branch name of the Nth previously checked out branch. - resolve_
ref - Resolve a reference to its target
ObjectId, following symbolic refs. - should_
autocreate_ reflog - Whether a new reflog file may be auto-created for
refname(Gitshould_autocreate_reflog). - should_
autocreate_ reflog_ for_ mode - Whether a new reflog file may be auto-created for
refnamegiven an already-resolvedcore.logAllRefUpdatesmode (including command-line config). - write_
ref - write_
symbolic_ ref - Write a ref, creating parent directories as needed.