I'm currently using git rev-parse origin/master
to retrieve the id of the last commit on master branch. But I would like to get the very last commit on any branch of the project. Is there a way to achieve this? Thank you.
EDIT: I found the way of retrieving the last commits IDs:
git for-each-ref --sort=-committerdate refs/heads/ --format='%(objectname)'
But I would like to retrieve only the very last ID instead of the whole list.