Git: How to check which files exist (and their content) in a shared (bare) repository?

3.3k Views Asked by At

I created a shared repo by:

git init --bare my_project.git

At some point, another user updated this repo with his changes (using git push).

How could I check which files are exist now in the shared repo and what is their content ?

In a local repo, I could do just ls and cat <some file>, but in the shared repo there is no working directory...

1

There are 1 best solutions below

2
On BEST ANSWER

You can find the files in the tree of a particular commit with git ls-tree, for example:

git ls-tree -r master

... would show the files in the tree of the commit at the tip of the master branch. Then, to "cat" a particular file, you can do:

git show master:docs/README

... supposing the master branch had a file called docs/README.