How to find blob in tree by its name

124 views Asked by At

I have a tree of commit found by SHA-1,code is: tree = repo.tree(sha) now I need to find blob by file name and display its content

1

There are 1 answers

2
Adam Dymitruk On

given the SHA1 of the commit itself, you would:

git show SHA1:path/to/your/file.txt

if you know the sha1 of the blob itself, you can

git cat-file blob SHA1