Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要一个 shell 命令行来放置与特定提交哈希相对应的树哈希。我知道git cat-file commit $COMMITID | grep ^tree可以做到,但我必须过滤它的输出。有没有只打印哈希的命令?
git cat-file commit $COMMITID | grep ^tree
git rev-parse $COMMITID^{tree}
git log -1 --pretty="%T" $COMMITID
您可以在rev-parse顶级目录中使用冒号进行提交:
rev-parse
:
git rev-parse ${COMMITID}: