Git

Git | alias to get current commit hash


Solution

It seems that there is a dedicated command. See the comments section.


First solution

If you make an alias. You can easily get a commit hash just by $ git revision .

 [alias] revision = !git show -s --format=%H 

Example:

 $ git revision 55176575a31a65118760c30e64cde839e9bb20a3 


application

It is easy to get past commit hashes by specifying HEAD.

$ git revision HEAD^

$ git revision HEAD^^


environment


  • git version 2.3.8 (Apple Git-58)


reference


Original by

Git | 現在のコミットハッシュを得るエイリアス


About

About this translattion