[work] 如何download github里面一个指定文件夹

Update Sep. 2016: there are a few tools created by the community that can do this for you:


Git doesn't support this, but Github does via SVN. If you checkout your code with subversion, Github will essentially convert the repo from git to subversion on the backend, then serve up the requested directory.

Here's how you can use this feature to download a specific folder. I'll use the popular javascript library lodash as an example.

  1. Get the repo URL. First, copy the URL of the Github repo to your clipboard. github repo URL example

  2. Modify the URL for subversion. I want to download the folder at /docs from the masterbranch, so I will append trunk/docs. Full URL is now https://github.com/lodash/lodash/trunk/docs. See my note below for a more in-depth explanation of why we must use this URL format.

  3. Download the folder. Go to the command line and grab the folder with SVN.  svn checkout https://github.com/lodash/lodash/trunk/docs

You might not see any activity immediately because Github takes up to 30 seconds to convert larger repositories, so be patient.

Full URL format explanation:

  • If you're interested in master branch, use trunk instead. So the full path is trunk/foldername
  • If you're interested in foo branch, use branches/foo instead. The full path looks like branches/foo/foldername
  • Protip: You can use svn ls to see available tags and branches before downloading if you wish

That's all! Github supports more subversion features as well, including support for committing and pushing changes.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值