Using Subversion to Export GitHub Subdirectories

The other day I was trying to download part of an absolutely massive GitHub repository and it took quite a bit of googling to figure out how to do it quickly. I ended up finding a great way to do it using Apache Subversion from the command line.

First, install subversion through brew

brew install subversion

Then, get the directory URL directly from github. For demonstration purposes, I’ll grab a random directory from the postgres repository

There is one change we have to make to the URL before it can work with SVN, replace tree/master with trunk and paste it into the console in the appropriate directory.

svn export

That should automatically retrieve the correct directory and any subdirectories.