Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我通过以下方式创建了一个共享仓库:
git init --bare my_project.git
在某个时候,另一个用户用他的更改(使用git push)更新了这个 repo。
git push
我如何检查共享存储库中现在存在哪些文件以及它们的内容是什么?
在本地仓库中,我可以只做lsand cat <some file>,但在共享仓库中没有工作目录......
ls
cat <some file>
您可以使用 找到特定提交的树中的文件git ls-tree,例如:
git ls-tree
git ls-tree -r master
... 将在主分支的顶端显示提交树中的文件。然后,要“cat”特定文件,您可以执行以下操作:
git show master:docs/README
...假设master分支有一个名为docs/README.
master
docs/README