Git command to display HEAD commit id?

前端 未结 9 1752
轮回少年
轮回少年 2020-12-22 15:27

What command can I use to print out the commit id of HEAD?

This is what I\'m doing by hand:

$ cat .git/HEAD
ref: refs/heads/v3.3
$ cat .git/refs/head         


        
9条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-22 15:39

    Old thread, still for future reference...:) even following works

    git show-ref --head
    

    by default HEAD is filtered out. Be careful about following though ; plural "heads" with a 's' at the end. The following command shows branches under "refs/heads"

     git show-ref --heads
    

提交回复
热议问题