Jason Meridth's Blog Learn, Converse, Share

How to Get The SHA of The Last Commit on a Branch With Git

I’ve been asked this a few times and have had to do it lately a few times.

To get the SHA of the last commit from a specific branch, use git rev-parse

git rev-parse origin/master (remote branch)

or

git rev-parse master (local branch)

Have feedback on this post? Let @jmeridth know on Twitter.