How do you use Git to retrieve just one (or a few) files from a repo?

Go To StackoverFlow.com

1

Possible Duplicate:
Partial clone with Git and Mercurial

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

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!)

2012-04-04 03:22
by Programmer
You cannot clone one file, you can only clone repositories. Why don't you just explicitly copy the files - benjgorman 2012-04-04 03:30
Possible dup: http://stackoverflow.com/questions/2586824/partial-clone-with-git-and-mercuria - amcnabb 2012-04-04 03:39
Please don't repost questions, instead edit them to add the required details - Lasse Vågsæther Karlsen 2012-04-04 09:34


1

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.

2012-04-04 03:46
by Jesus Ramos


0

git works at the repository level, not at the file level (unlike CVS/SVN).

As a result, if you clone you usually clone the whole repo - and a change is tracked as a repository content change - not a simple file change.

2012-04-04 05:18
by ptyx
Ads