git ls-文件在裸仓库中 [英] git ls-files in bare repository
问题描述
在一个正常的git仓库中,我可以通过运行轻松地完成这项工作。
我想访问一个纯粹的git仓库,并且想列出仓库中的所有文件。 git ls-files
。
示例输出:
$ git ls-files
README.md
file1.js
file2.js
file3.js
folder1 / file4.js
folder2 / file5.js
在一个纯粹的git仓库中,这个失败了。它只是不返回任何文件(但成功退出):
$ cd my-bare-repository
$ git ls-files #returns nothing
$ echo $? #打印上一条命令的退出代码
$ 0
现在我知道我必须提供一个有意义的分支或主人来展示。但是,我怎么才能真正得到我知道存在于我的存储库中的这些文件列表?
您可以尝试其他命令哪些列表文件: git ls-tree --full-tree -r HEAD
根据对此评论,命令 git ls-tree 的作品在 裸露的回购 。
I want to access a bare git repository, and I want to list all files in the repository.
On a normal git repository I can easily do that by running git ls-files
.
Example output:
$ git ls-files
README.md
file1.js
file2.js
file3.js
folder1/file4.js
folder2/file5.js
In a bare git repository this fails silently. It just doesn't return any files (but exits successfully):
$ cd my-bare-repository
$ git ls-files #returns nothing
$ echo $? #print exit code from previous command
$ 0
Now I am aware that I have to provide a meaningful branch or master to display. But how can I actually get this list of the files that I know are in my repository?
You can try the other command which list files:
git ls-tree --full-tree -r HEAD
According to this comment, the command git ls-tree works in bare repo.
这篇关于git ls-文件在裸仓库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!