Easy Tutorial
❮ Database Implementation Android Tutorial Drawable3 ❯

Downloading Individual Directories or Files from GitHub Using SVN

Category Programming Technology

Projects on GitHub, when using git clone, can only download the entire project. Sometimes, we might only need a single directory or file, and in such cases, we can use the svn command to operate.

The main modification is in the URL of the opened directory file: replace /tree/master/ (or /tree/branch/) with /trunk/.

Example 1: /tree/master/

For instance, if we want to copy the ch03 directory from the https://github.com/Mooophy/Cpp-Primer project.

  1. First, open the ch03 directory with a mouse click and copy the URL:

    https://github.com/Mooophy/Cpp-Primer/tree/master/ch03
    
  2. Replace /tree/master/ with /trunk/, and use the svn command to check out:

    svn co https://github.com/Mooophy/Cpp-Primer/trunk/ch03
    

Example 2: /tree/branch/

For example, if I want to download the source directory from https://github.com/numbbbbb/the-swift-programming-language-in-chinese/.

https://github.com/numbbbbb/the-swift-programming-language-in-chinese/tree/gh-pages/source

Replace /tree/gh-pages/ with /trunk/.

  1. Then enter the following command to load:
    svn co https://github.com/numbbbbb/the-swift-programming-language-in-chinese/trunk/source
    
❮ Database Implementation Android Tutorial Drawable3 ❯