I\'m working with a repository with a very large number of files that takes hours to checkout. I\'m looking into the possibility of whether Git would work well with this kin
Please note that this answer does download a complete copy of the data from a repository. The git remote add -f
command will clone the whole repository. From the man page of git-remote:
With
-f
option,git fetch
is run immediately after the remote information is set up.
Try this:
mkdir myrepo
cd myrepo
git init
git config core.sparseCheckout true
git remote add -f origin git://...
echo "path/within_repo/to/desired_subdir/*" > .git/info/sparse-checkout
git checkout [branchname] # ex: master
Now you will find that you have a "pruned" checkout with only files from path/within_repo/to/desired_subdir present (and in that path).
Note that on windows command line you must not quote the path, i.e. you must change the 6th command with this one:
echo path/within_repo/to/desired_subdir/* > .git/info/sparse-checkout
if you don't you'll get the quotes in the sparse-checkout file, and it will not work