JM (Jason Meridth)

JM (Jason Meridth)

Learn, Converse, Share

11 Mar 2014

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)

Tags