how can I do it with this library? the best I could find is:
\nfor file in repo.commit().tree.blobs:\n print(file.abspath)
but that only lists files in the top dictionary.
\nThanks
","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"You are probably looking for this:
\nfor entry in repo.commit().tree.traverse():\n print(entry)
There are fields or methods on the returned entries to obtain their name or path relative to the root tree.
","upvoteCount":1,"url":"https://github.com/gitpython-developers/GitPython/discussions/1277#discussioncomment-909660"}}}-
Hey all, How do I get a list of all file? using git I can run git ls-tree HEAD -r how can I do it with this library? the best I could find is: for file in repo.commit().tree.blobs:
print(file.abspath) but that only lists files in the top dictionary. Thanks |
Beta Was this translation helpful? Give feedback.
-
You are probably looking for this: for entry in repo.commit().tree.traverse():
print(entry) There are fields or methods on the returned entries to obtain their name or path relative to the root tree. |
Beta Was this translation helpful? Give feedback.
-
To complete this, if you want a file listing, you want:
or
|
Beta Was this translation helpful? Give feedback.
You are probably looking for this:
There are fields or methods on the returned entries to obtain their name or path relative to the root tree.