3

使用 svn 检出 GitHub 项目中的子目录

 2 years ago
source link: https://blog.nanpuyue.com/2019/051.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

使用 svn 检出 GitHub 项目中的子目录

例如我们想检出 https://github.com/openwrt/packages 项目下的 net/nginx 子目录,但是不想把整个项目克隆下来。

可以利用 svn 来实现, svn 支持 --depth 选项,具体有 empty/files/immediates/infinity 四种参数,含义如下:

      depth-empty ------>  Updates will not pull in any files or
                           subdirectories not already present.
   
      depth-files ------>  Updates will pull in any files not already
                           present, but not subdirectories.
   
      depth-immediates ->  Updates will pull in any files or
                           subdirectories not already present; those
                           subdirectories' this_dir entries will
                           have depth-empty.
   
      depth-infinity --->  Updates will pull in any files or
                           subdirectories not already present; those
                           subdirectories' this_dir entries will
                           have depth-infinity.  Equivalent to
                           today's default update behavior.

1) 检出项目

svn co --depth=empty https://github.com/openwrt/packages/trunk packages

注意这里的 trunk,对应 git 的 master 分支。

2) 更新一级子目录

cd packages
svn up --depth=empty net

3) 更新我们需要的子目录

svn up net/nginx

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK