特定提交哈希的树哈希是什么?

特定提交哈希的树哈希是什么?

问题描述:

我需要一个shell命令行,该命令行将树哈希与特定的提交哈希相对应.我知道git cat-file commit $COMMITID | grep ^tree可以做到,但是我必须过滤它的输出.有没有只打印哈希值的命令?

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?

git log -1 --pretty="%T" $COMMITID