Download a Git subdirectory from GitHub
Have you ever needed to download only a subdirectory from a GitHub project without downloading the entire repository? Surprisingly, there doesn’t seem to be a way of doing this easily using Git. A somewhat unexpected solution is to use SVN.
First get the URL of the subfolder. GitHub URLs have the form:
/trunk/ to get:
You can now download the subdirectory you’re interested in using SVN’s export command:
svn export https://github.com/author/repo/trunk/subdirectory
For example, this command will download a “Hello World” Chrome extension sample from GitHub:
svn export https://github.com/GoogleChrome/chrome-app-samples/trunk/samples/hello-world
Credit: Stack Overflow
I'm available for contract work in Edinburgh and can also work remotely.