Need a developer?

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:

Then replace /tree/master/ with /trunk/ to get:

You can now download the subdirectory you’re interested in using SVN’s export command:

svn export

For example, this command will download a “Hello World” Chrome extension sample from GitHub:

svn export

Credit: Stack Overflow