for-each-ref's older, simpler sibling.
git show-ref lists refs (branches, tags, HEAD) with their SHAs. It's the older, simpler sibling of for-each-ref.
Walks .git/refs and packed-refs, prints '<sha> <refname>' lines. No format string, no sorting, no fancy filters - just refs and hashes.
git show-ref [-q|--quiet] [--verify] [--head] [-d|--dereference]
[-s|--hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]
git show-ref --exists <ref>| Flag | What it does |
|---|---|
--head | Include HEAD in the listing. |
--heads | Limit to refs/heads/* (local branches). |
--tags | Limit to refs/tags/*. |
-d, --dereference | For annotated tags, also show the dereferenced commit as <ref>^{}. |
-s, --hash[=<n>] | Print only the SHA (optionally abbreviated). |
--abbrev[=<n>] | Abbreviate the SHA to <n> hex chars. |
--verify | Strict mode: arg must be a full ref (refs/...); fail otherwise. |
-q, --quiet | No output; exit code only - useful with --verify or --exists. |
git show-ref --exists refs/heads/maingit show-ref --headgit show-ref --tags --hash=12git show-ref --verify --quiet refs/heads/maingit show-ref -d --tagsHit each option, then Check answers. Score is recorded; Next is always open.