Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the tree hash of a specific commit hash?

Tags:

git

I need a shell command-line which puts the tree hash corresponding to a specific commit hash. I know that git cat-file commit $COMMITID | grep ^tree can do it, but I have to filter the output of that. Is there any command which prints only the hash?

like image 747
pts Avatar asked May 04 '13 09:05

pts


2 Answers

git log -1 --pretty="%T" $COMMITID 
like image 74
Klas Mellbourn Avatar answered Sep 30 '22 20:09

Klas Mellbourn


git rev-parse $COMMITID^{tree}
like image 30
Stefan Näwe Avatar answered Sep 30 '22 20:09

Stefan Näwe