可以使用sparse checkout功能在同步远程仓库时候,不拉取这些文件,给磁盘留出多一些的可用空间。
若已经拉取了代码,则不用走上面的步骤。 2、进入仓库目录,在Config中允许使用Sparse Checkout模式: git config core.sparsecheckouttrue 3、创建sparse-checkout文件 touch.git/info/sparse-checkout 4、编辑.git/info/sparse-checkout vim .git/info/sparse-checkout 5、告诉Git哪些文件或文件夹是你需要排除的 ...
情况 1:当您尚未克隆存储库时 mkdir git-srccd git-srcgit initgit config core.sparseCheckout trueecho "/assets/" >> .git/info/sparse-checkoutgit remote add origin git@github.com:shenxianpeng/shenxianpeng.gitgit fetchgit checkout master 情况 2:当您已经克隆了一个存储库时 cd git-srcgit c...
1. 创建一个新的git仓库或进入一个已存在的git仓库。 2. 使用`git sparse-checkout init`命令初始化稀疏检出功能。 3. 使用`git sparse-checkout set`命令设置要检出的文件或目录。例如,要检出`src`目录和`README.md`文件,可以使用以下命令: “` git sparse-checkout set src git sparse-checkout set REA...
要拉取一个指定的文件夹,你可以使用Git的sparse checkout功能。下面是具体步骤: 1. 首先,创建一个新的Git仓库或者进入已有的Git仓库。 2. 使用命令 `git init` 初始化一个新的Git仓库,或者使用命令 `cd` 进入一个已有的Git仓库。 3. 然后,使用命令 `git config core.sparsecheckout true` 开启sparse check...
Git的sparse checkout在clone项目仓库时只clone指定路径下的信息。 步骤如下: (1) mkdir yourdir (2) cd yourdir (3) git init (4) git config core.sparseCheckout true (5) echo '/PATH_LEVEL1/PATH_LEVEL2/*' >> .git/info/sparse-checkout ...
git clone -n --filter=blob:none git@github.com:<URL>.git folderPath cd folderPath git sparse-checkout init git sparse-checkout set MY/DIR1 SUB/DIR2 解释: clone: --filter=blob:none 表示过滤掉所有文件,只会下载一个 .git 文件。必须配合 -n 使用。 -n 表示不需要 checkout 到 HEAD 参...
By default, when runninggit sparse-checkout init, the root directory is added as a parent pattern. At this point, the sparse-checkout file contains the following patterns: /* !/*/ This says "include everything in root, but nothing two levels below root." ...
WARNING:Using a sparse index requires modifying the index in a way that is not completely understood by external tools. If you have trouble with this compatibility, then rungit sparse-checkout init --no-sparse-indexto rewrite your index to not be sparse. Older versions of Git will not under...
1.开启sparse checkout功能 开启: git config core.sparsecheckout true 或者 git sparse-checkout init 2.写入要获取的文件 1)写入文件: echo "x x x" >> .git/info/sparse-checkout 例如: echo "Test" >> .git/info/sparse-checkout 表示只拉取Test文件夹, 或者使用命令 ...