你如何使用Git从回购中检索一个(或几个)文件? [英] How do you use Git to retrieve just one (or a few) files from a repo?
问题描述
可能重复:
部分克隆Git和Mercurial
我切换到我想要将我的repo文件复制到的特定目录中,然后尝试以下操作:
I switched into the specific directory into which I'd like my repo file to be copied into, and then tried the following:
git clone git@github.com:path/to/file.java
但它给了我ERROR:repository not找到
but it's giving me ERROR: repository not found
任何人都可以告诉我发生了什么事情,什么是正确的做法? (一个小背景不会伤害!)
Can anyone tell me what's going on, and what's the right thing to do? (a little background doesn't hurt!)
推荐答案
您可能想要查看一个名为稀疏检出的内容, Git 1.7我相信。在此之前,我不认为git允许你这样做,尽管在github上你总是可以通过打开文件并保存文件来从他们的web界面复制单个文件。
You may want to look into something called a sparse checkout which was implemented in Git 1.7 I believe. Before that I don't think git allowed you to do so although on github you can always copy individual files from their web interface by opening the file and saving it.
这篇关于你如何使用Git从回购中检索一个(或几个)文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!