从存储库中检索单个文件

编程入门 行业动态 更新时间:2024-10-12 01:23:59
本文介绍了从存储库中检索单个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 什么是最有效的机制(就数据传输和磁盘空间而言)从远程git存储库获取单个文件的内容?

远远我设法得到:

git clone --no-checkout --depth 1 git@github :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: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.

更多推荐

从存储库中检索单个文件

本文发布于:2023-11-28 16:28:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643128.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:库中   文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!