Download Part of a Large GitHub Repo Using SVN

Whether you’re using “microservices in a monorepo” design or just need a subdirectory of a large GitHub repo, you definitely don’t have to clone the entire repo to work with just a handful of files. Instead, use GitHub’s ability to convert any to repo to SVN, to get just the files you need.

Here’s how it works. Consider the Linux kernel repository. Say you’re working on the GPU documentation, in the Documentation/gpu subdirectory of this repo. Start by opening the directory in your browser & noting its URL. In our case, it’s https://github.com/torvalds/linux/tree/master/Documentation/gpu. Now just replace the tree/master part of the URL by trunk & use the resulting URL in SVN checkout:

> svn checkout https://github.com/torvalds/linux/trunk/Documentation/gpu
A    gpu/afbc.rst
A    gpu/amdgpu-dc.rst
A    gpu/amdgpu.rst
...
A    gpu/vgaarbiter.rst
A    gpu/vkms.rst
A    gpu/xen-front.rst
Checked out revision 1006575.

That’s all there’s to it! You now have the gpu directory cloned!