Code: Select all
git clone --depth 1 --filter=blob:none --sparse <repo>
Code: Select all
cd <repo folder>
git sparse-checkout set <subfolder>
For example consider this repo:
Code: Select all
https://github.com/dotnet/samples
Code: Select all
https://github.com/dotnet/samples/tree/main/core/interop/cpp-cli
Step 1
Code: Select all
git clone --depth 1 --filter=blob:none --sparse https://github.com/dotnet/samples
Code: Select all
cd samples
git sparse-checkout set cpp-cli
This will check out that subfolder:
Code: Select all
Volume in drive D has no label.
Volume Serial Number is 7410-AB8C
Directory of D:\Projects\samples\core\interop\cpp-cli
22/09/2022 09:41 AM <DIR> .
22/09/2022 09:41 AM <DIR> ..
22/09/2022 09:41 AM 3,853 CPP-CLI.sln
22/09/2022 09:41 AM 205 Directory.Build.props
22/09/2022 09:41 AM <DIR> ManagedApp
22/09/2022 09:41 AM <DIR> ManagedLibrary
22/09/2022 09:41 AM <DIR> MixedLibrary
22/09/2022 09:41 AM <DIR> NativeApp
22/09/2022 09:41 AM 2,684 README.md
22/09/2022 09:41 AM 34 snippets.5000.json
4 File(s) 6,776 bytes