![]() This option was added together with an update to the remote protocol, and it truly prevents objects from being downloaded from the server.Į.g., to clone only objects required for d1 of this minimal test repository: I can do: git clone \ Git clone -filter from git 2.19 now works on GitHub (tested, git 2.30.0) TL DR: Use all of -filter, sparse checkout and shallow clone to reduce the total download, or only use sparse checkout shallow clone if you don't care about the total download and just want that one directory however it may be obtained. ![]() Remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0 Remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0 Remote: Counting objects: 100% (1/1), done. % git checkout origin/master - UbuntuMono Remote: Total 52 (delta 1), reused 35 (delta 1), pack-reused 0 Remote: Compressing objects: 100% (49/49), done. Using the -filter checkout method in Ciro Santilli's answer really cuts down the size, but as mentioned there, downloads each blob one by one, which is slow: % git fetch -depth=1 -filter=blob:none Remote: Total 310 (delta 75), reused 260 (delta 71), pack-reused 0 The steps above ended up downloading some 11 MB, where the Ubuntu Fonts themselves are ~900 KB: % git pull -depth=1 origin master I had an occasion to test this again recently, trying to get only the Ubuntu Mono Powerline fonts. Instead of a normal git pull, try: git pull -depth=1 origin master You might be better off using a shallow clone. Should probably read the official documentation for sparse You might want to have a look at the extended tutorial and you git/info/sparse-checkoutĮcho "another/sub/tree" >. git/info/sparse-checkout, eg: echo "some/dir/" >. Now you need to define which files/folders you want to actually check Then do: git config core.sparseCheckout true This creates an empty repository with your remote, and fetches all Just add the remote without a fetch: git remote add origin Īnd then do a shallow fetch like described later. It will do a fetch, which will pull in the entire history. Since I'm quoting another post, I don't want to edit the quoted parts, but do not use -f with git remote add. The steps to do a sparse clone are as follows: mkdir You will end up downloading the entire history, so I don't see much benefit in it, but you can checkout specific parts using a "sparse" checkout.
0 Comments
Leave a Reply. |