从存储库中检索单个文件 [英] Retrieve a single file from a repository
本文介绍了从存储库中检索单个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
远远我设法得到:
git clone --no-checkout --depth 1 git@github.com :foo / bar.git&& cd bar&& git show HEAD:path / to / file.txt
这看起来似乎过分了。
如何从repo获取多个文件?
解决方案
in git version 1.7.9.5这似乎工作从远程导出单个文件
git archive --remote = ssh:// host / pathto / repo.git HEAD README.md
这会捕获文件的内容, README.md
。
What is the most efficient mechanism (in respect to data transferred and disk space used) to get the contents of a single file from a remote git repository?
So far I've managed to come up with:
git clone --no-checkout --depth 1 git@github.com:foo/bar.git && cd bar && git show HEAD:path/to/file.txt
This still seems overkill.
What about getting multiple files from the repo?
解决方案
in git version 1.7.9.5 this seems to work to export a single file from a remote
git archive --remote=ssh://host/pathto/repo.git HEAD README.md
This will cat the contents of the file README.md
.
这篇关于从存储库中检索单个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文