How can I check with the command line the latest commit hash of a particular Git branch?
git log -n 1 [branch_name]
branch_name
(may be remote or local branch) is optional. Without branch_name
, it will show the latest commit on the current branch.
For example:
git log -n 1 git log -n 1 origin/master git log -n 1 some_local_branch git log -n 1 --pretty=format:"%H" #To get only hash value of commit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With