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
In 2020 there is a simpler way to deal with sparse-checkout without having to worry about .git files. Here is how I did it:
git clone --no-checkout
cd
git sparse-checkout init --cone # to fetch only root files
git sparse-checkout set apps/my_app libs/my_lib # etc, to list sub-folders to checkout
# they are checked out immediately after this command, no need to run git pull
Note that it requires git version 2.25 installed. Read more about it here: https://github.blog/2020-01-17-bring-your-monorepo-down-to-size-with-sparse-checkout/
UPDATE:
The above git clone command will still clone the repo with its full history, though without checking the files out. If you don't need the full history, you can add --depth parameter to the command, like this:
# create a shallow clone,
# with only 1 (since depth equals 1) latest commit in history
git clone --no-checkout --depth 1