4

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...

Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746

1 Answers1

8

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.

Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
Mark Longair
  • 446,582
  • 72
  • 411
  • 327