Skip to content

Instantly share code, notes, and snippets.

@khandelwaly
Last active May 13, 2021 05:57
Show Gist options
  • Select an option

  • Save khandelwaly/3e790a0aaa9ebf38d829f5aa1eeb0def to your computer and use it in GitHub Desktop.

Select an option

Save khandelwaly/3e790a0aaa9ebf38d829f5aa1eeb0def to your computer and use it in GitHub Desktop.

How to get latest git commit id

git log -n 1 --pretty=format:'%h'
git log -n 1 --pretty=format:'%H'       

%h for abbreviated commit hash
%h for commit hash
git log | grep commit | head -1 | awk '{print $2}'
git rev-parse HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment