See also: https://unix.stackexchange.com/questions/233327/is-it-possible-to-clone-only-part-of-a-git-project
Clone with a specific history depth (--depth
) and start at the root of the repository (--sparse
).
You can also filter-out BLOB files. For example:
git clone --sparse --depth 1 --filter blob:none --branch master https://github.com/NowhereLand/helloworld
Change directory into the newly-cloned repository and enable sparse-checkout mechanism (to fetch parts of the subtree in steps of increasing depth)
cd helloworld
git sparse-checkout init --cone
Checkout a subtree, say at /src/main/resources
:
git sparse-checkout set src/main/resources/