Skip to content

Instantly share code, notes, and snippets.

@kamontat
Last active December 28, 2017 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamontat/100cf96be3bb662606cbbf0e0b9f3243 to your computer and use it in GitHub Desktop.
Save kamontat/100cf96be3bb662606cbbf0e0b9f3243 to your computer and use it in GitHub Desktop.

Useful-git-command

$ git rev-parse HEAD # git latest commit 
3386d270952e7d8dc614839bfb00de3529d56c77

$ git rev-parse --verify HEAD # git latest commit 
3386d270952e7d8dc614839bfb00de3529d56c77

$ git show-ref # turn references (branches and tags) into SHA-1
3386d270952e7d8dc614839bfb00de3529d56c77 refs/heads/master
0a38eedb70b8e17da7100ac17fb1e374f8ae83cc refs/tags/v1.0.0

$ git for-each-ref # same as `show-ref` but difference format
3386d270952e7d8dc614839bfb00de3529d56c77 commit	refs/heads/master
0a38eedb70b8e17da7100ac17fb1e374f8ae83cc tag	refs/tags/v1.0.0

$ git rev-list --all --count # count commit number
20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment