快速下载 GitHub 上项目下的子目录
GitHub 上有一些开源项目,会将示例项目放在某个专门的子目录下,如果只对其中一个目录感兴趣,不想下载整个项目的话,该怎么办呢?
svn export!
比如,https://github.com/keycloak/keycloak-quickstarts 这个仓库有很多示例项目,我要下载其中一个目录,那么先定位到这个目录:
https://github.com/keycloak/keycloak-quickstarts/tree/latest/app-springboot

记下链接后,做一个小替换:
把 tree 改成 branches,然后执行 svn export:
svn export https://github.com/keycloak/keycloak-quickstarts/branches/latest/app-springboot亲测有效!
jeff-tian/app-springboot➜ tree.├── README.md├── config│ └── client-import.json├── pom.xml└── src├── main│ ├── java│ │ └── org│ │ └── keycloak│ │ └── quickstart│ │ └── springboot│ │ ├── ProductApplication.java│ │ ├── config│ │ │ └── SecurityConfig.java│ │ ├── service│ │ │ └── ProductService.java│ │ └── web│ │ └── ProductController.java│ └── resources│ ├── application.properties│ └── templates│ ├── landing.ftl│ └── products.ftl└── test├── java│ └── org│ └── keycloak│ └── quickstart│ └── springboot│ └── ProductAppTest.java└── resources├── application.properties└── quickstart-realm.json20 directories, 13 files
如果没有预装 svn,那么可以相应安装一下,对于 Mac,可以使用:
brew install svn若有收获,就点个赞/在看/打个赏吧。
虽然工作中一般是使用 git,但是在某些情况下,svn 也挺好用的,可以辅助使用。
预告
这篇工作生活小妙招,只是一个插曲,正在准备部署一个支持 keycloak 登录的 spring-boot 项目。到时候再分享心得,欢迎持续关注。
评论
