How can I get all symbolic names from a Git commit hash?
It should be possible to achieve what you want thanks to the git for-each-ref
command:
git for-each-ref --points-at=HEAD
Complete example session:
$ git init
$ touch a
$ git add a
$ git commit -m a
[master (root-commit) eb3222d] a
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a
$ git checkout -b branch1
Switched to a new branch 'branch1'
$ git checkout -b branch2
Switched to a new branch 'branch2'
$ git tag tag1
$ git tag tag2
$ git tag -a tag3 -m "annotated tag"
$ git for-each-ref --points-at=HEAD
eb3222db1821633a54ccd0a6434e883c4cb71b98 commit refs/heads/branch1
eb3222db1821633a54ccd0a6434e883c4cb71b98 commit refs/heads/branch2
eb3222db1821633a54ccd0a6434e883c4cb71b98 commit refs/heads/master
eb3222db1821633a54ccd0a6434e883c4cb71b98 commit refs/tags/tag1
eb3222db1821633a54ccd0a6434e883c4cb71b98 commit refs/tags/tag2
0dbba96f519c2ad1b470f97171230004addff896 tag refs/tags/tag3