How to find the hash of branch in Git?


Given a local / remote branch name, how could I get the hash of the commit that this branch points to?


The command git rev-parse is your friend, e.g.:

… or for a remote-tracking branch:

This command is generally very useful, since it can parse any of the ways of specifying branch names in git, such as:

… etc.

Leave a Reply