美文网首页
20200512-github获取仓库中指定文件夹

20200512-github获取仓库中指定文件夹

作者: JeremyL | 来源:发表于2020-05-12 12:00 被阅读0次

获取仓库中指定文件,而不用下载整个仓库。

"Sparse checkout" allows to sparsely populate working directory. It uses skip-worktree bit (see git-update-index(1)) to tell Git whether a file on working directory is worth looking at.

命令

#初始化
git init
#启用Sparse Checkout
git config core.sparseCheckout true
#在sparse-checkout文件中指定文件目录信息(需要拉取的目录);多个文件,多次写入即可
echo 'github file directory' >> .git/info/sparse-checkout
#查看.git/info/sparse-checkout文件
vi .git/info/sparse-checkout
#添加远程仓库
git remote add -f origin https://github.com/****.git
#拉取
git pull origin master

当前工作目录下只会有下载指定的目录;这种方法对于获取大的项目部分信息是极为方便的。

参考:
Sparse checkout
Git 使用指南

相关文章

  • 20200512-github获取仓库中指定文件夹

    获取仓库中指定文件,而不用下载整个仓库。 首先你需要了解Sparse checkout "Sparse check...

  • Docker镜像常用命令

    获取镜像 获取指定版本的镜像 获取最新镜像 如果从非官方的仓库下载,则需要在仓库名称前指定完整的仓库地址: 查看镜...

  • 2022-11-16

    创建 git 仓库(仓库aaa,项目为bbb) 已有仓库? 删除文件或文件夹 1、在本地仓库删除指定文件 2、在本...

  • 2.1 Git 基础 - 获取 Git 仓库

    获取 Git 仓库 在已存在目录中初始化仓库 如果在一个已存在文件的文件夹(而非空文件夹)中进行版本控制,你应该开...

  • Git Bash初体验(常用命令)

    在指定文件夹中,右键git bash打开命令窗口 2.git init 初始化本地仓库 当前文件夹中会出现.git...

  • git bash 命令

    在指定文件夹中,右键git bash打开命令窗口 2.git init 初始化本地仓库 当前文件夹中会出现.git...

  • 代码

    获取指定文件夹下的文件夹目录import os.pathsub_dirs = [x[0] for x in os....

  • 制作自己的CocoaPods公开库(涉及modulemap)

    创建GIT仓库 将仓库克隆到本地指定目录,该目录下将自动创建HCKit-Swift文件夹,并且包含LICENSE和...

  • 使用Xlua加载目录下的.lua文件

    1.Scripts name :LuaController 使用Fill.ReadAllBytes来获取指定文件夹...

  • ClassUtil

    功能列表 获取指定 classloader 中已加载的类; 获取指定 classloader 中已加载且带有指定注...

网友评论

      本文标题:20200512-github获取仓库中指定文件夹

      本文链接:https://www.haomeiwen.com/subject/kxcbnhtx.html