Sunday 6 September 2015

Download only part of a repository in github

Sometimes you would want to download only a part of a repository in Github but you don't want to download / clone the entire repository, specially when the repo is huge or has too many other things that you are not interested in. There are many ways to do this. For example you can do a shallow clone, or you can use Github API (there is a limit on number of requests per hour)..etc. However, none of them are simple and straightforward. 

I recently found out that Github supports svn to some extent. So I tried the age old svn export to download a part of the project I was interested in. And it worked.

svn export https://github.com/<username>/<project name>/trunk/<folder path>

For example:


If you want to download only docs from Bootstrap repository,

svn export https://github.com/twbs/bootstrap/trunk/docs

Now, suppose you want to download it with a different name,

svn export https://github.com/twbs/bootstrap/trunk/docs bootstrap-docs


No comments:

Post a Comment