For projects on github, using git clone can only download the entire project. Sometimes we may only need a single directory or file; in this case, we can use the svn command to do it.

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 example, we want to copyhttps://github.com/Mooophy/Cpp-Primerthe ch03 directory under the project.

1. First open the ch03 directory by clicking it, and copy the URL address:

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, I want to downloadhttps://github.com/numbbbbb/the-swift-programming-language-in-chinese/undersourcedirectory.

1. First click to open the source directory, and copy the URL address:
https://github.com/numbbbbb/the-swift-programming-language-in-chinese/tree/gh-pages/source

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

2. Then enter the following command to load

svn co https://github.com/numbbbbb/the-swift-programming-language-in-chinese/trunk/source