It is related to Making git show to show information in a machine parseable format but I am getting tired of the fact that I now have to do a lot of parsing to get the commi
What about git log -1 --format=format:"%H" mylabel
EDIT:
Actually a better solution would be :
git show-ref -s mylabel
EDIT bis: As mentioned in the comments, be careful with annotated commits (which are objects of their own). To have a more generic solution, read @michas answer.
You can see the difference when you do a git show-ref -d mylabel.
Resources: