Using the command git show-ref --tags
I can see all the tags and the SHA1 hashes for all these tags.
I would like a similar command for trees: a command to output all the SHA1 hashes for all the tree objects, but for nothing else.
您可以找到从 HEAD 指针访问的所有对象
git ls-tree -r -t HEAD
sed
因此您可以使用or进行过滤以仅查找树对象awk
,例如,
git ls-tree -r -t HEAD | awk '$2 == "tree" { print $0 }'
git rev-list --all --objects | # everything reachable, with path
cut -d' ' -f1 | # don't want the path
git cat-file --batch-check | # append type and size
awk '$2=="tree"' # just the trees