git show-ref
git show-ref [--heads | --tags]
Risk: Safe
What it does
Lists your refs (branches and tags) with the commit id of each.
When to use it
To see every name Git keeps, in a script-friendly list.
Example
$ git show-refEach line: an id, then a ref like refs/heads/main.
$ git show-ref --headsOnly branches.
Learn it in: Refs, the HEAD file and reftable · Official docs