Jonas Byström Jonas Byström - 1 month ago 6
Git Question

List and cat files at certain commit

Is it possible in git to list all files in a directory at a certain commit, not just the changes? I'd like to not having to update my working tree (i.e.

git checkout
).

In the same spirit I'm also interested in doing the same thing with file contents (one would use
cat
in the working tree).

If this is not possible, then how does github, gitlab, bitbucket, etc. handle file listing/viewing internally?
git checkout
?

Answer

https://git-scm.com/docs/git-ls-tree

Individually git show <ref>:<path

You could have googled that.