Git command to list SHA1 hashes for all tree objects

Using the git show-ref --tags , I can see all the SHA1 tags and hashes for all of these tags.

I need a similar command for trees: a command to display all SHA1 hashes for all objects in the tree, but for nothing else.

+4
source share
2 answers

You can find all the objects accessible from the HEAD pointer.

 git ls-tree -r -t HEAD 

so that you can filter to find only tree objects using sed or awk for example

 git ls-tree -r -t HEAD | awk '$2 == "tree" { print $0 }' 
+2
source
 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 
+2
source

Source: https://habr.com/ru/post/1480007/


All Articles