To turn arbitrary extended object reference into SHA-1, use simply git-rev-parse, for example git rev-parse HEAD or git rev-parse --verify HEAD