如果这是一个裸仓库,您将无法在该repo.git文件夹中找到这些文件.
看到" 所有关于"裸"repos ":一个裸的repo没有工作树,并用于推送它(因为没有工作树与更新的分支保持同步)
查看这些文件的最简单方法是克隆所述裸仓库:
git clone /path/to/repo.git /path/to/repo
Run Code Online (Sandbox Code Playgroud)
我只知道一种黑客式的方法来查看裸存储库中的文件列表,而无需克隆:
GIT_DIR=/path/to/bare.git git log --pretty=format: --name-only --diff-filter=A
Run Code Online (Sandbox Code Playgroud)
您很可能想要对该输出进行排序并排除空行:
GIT_DIR=/path/to/bare.git git log --pretty=format: --name-only --diff-filter=A | sort | grep .
Run Code Online (Sandbox Code Playgroud)
不过,查看文件的内容非常干净:
GIT_DIR=/path/to/bare.git git show HEAD:path/to/file
Run Code Online (Sandbox Code Playgroud)
如果您想从裸存储库中获取特定文件而不是整个存储库,您可以将输出重定向git show到文件。
顺便说一句,GIT_DIR=... git cmd相当于git --git-dir=... cmd
| 归档时间: |
|
| 查看次数: |
4590 次 |
| 最近记录: |