$ git clone --mirror git@codeup.aliyun.com:6125fa3a03f23adfbed12b8f/linux.git linux
克隆到纯仓库 'linux'...
remote: Enumerating objects: 8345032, done.
remote: Counting objects: 100% (8345032/8345032), done.
remote: Total 8345032 (delta 6933809), reused 8345032 (delta 6933809), pack-reused 0
接收对象中: 100% (8345032/8345032), 3.26 GiB | 2.08 MiB/s, 完成.
处理 delta 中: 100% (6933809/6933809), 完成.
$ git clone --filter=blob:none --no-checkout git@codeup.aliyun.com:6125fa3a03f23adfbed12b8f/linux.git
正克隆到 'linux'...
remote: Enumerating objects: 6027574, done.
remote: Counting objects: 100% (6027574/6027574), done.
remote: Total 6027574 (delta 4841929), reused 6027574 (delta 4841929), pack-reused 0
接收对象中: 100% (6027574/6027574), 1.13 GiB | 2.71 MiB/s, 完成.
处理 delta 中: 100% (4841929/4841929), 完成.
monorepo
├── README
├── backend
│ └── command
│ └── command.go
├── docs
│ └── api_specification
├── frontend
│ ├── README.md
│ └── src
│ └── main.js
└── libraries
└── common.lib
$ git clone --filter=blob:none --no-checkout https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/monorepo.git
正克隆到 'monorepo'...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Total 24 (delta 0), reused 0 (delta 0), pack-reused 0
接收对象中: 100% (24/24), 2.62 KiB | 2.62 MiB/s, 完成.
$ cd monorepo
$ git config core.sparsecheckout true
$ echo "backend/*" > .git/info/sparse-checkout
$ tree .
.
└── backend
└── command
└── command.go
2 directories, 1 file
-
圆形,代表了commit对象,commit对象用于存储提交信息,并指向了父commit(如果存在)以及根tree对象。通过commit对象,我们可以回溯代码的历史版本。
-
三角形,代表一个tree对象,tree对象用于存储文件名及目录结构信息,并且指向blob对象或其他tree对象,由此组成嵌套的目录结构。
-
方块,代表了blob对象,存储了文件的实际内容
-
客户端限制: 本地的git版本在2.22.0或更高。
-
服务端filter限制: 目前, Codeup支持指定两种 --filter :
-
服务端功能开启限制: 目前,Codeup部分克隆功能正在灰度测试中,如果您对部分克隆有使用的需求,请提交工单与我们联系。
git clone --filter=blob:none <仓库地址>
git init .
git remote add origin <仓库地址>
git fetch --filter=blob:none origin
git switch master
git init .
git remote add origin <仓库地址>
git config remote.origin.promisor true
git config remote.origin.partialclonefilter blob:none
git fetch origin
git switch master
-
在第一个提交中,创建文件hello.txt,内容为hello world!
-
在第二个提交中,创建文件src/hello.go,内容为打印"hello world"
-
在第三个提交中,修改文件src/hello.go,修改输出内容为“hello Codeup"
git clone --filter=blob:none \
https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/partial-clone-tutorial.git
$ git rev-list --missing=print --objects HEAD
18990720b6e55a70ba9f9877213dad948e0973a2
e18cc4e7890e6ec832f683c1a0f58412b4a37964
2f7478bda13e73e1e1eaab6fae3d0dfd35e50b32
e7c719df0874ebd3b2ec02666d65879e986d537d
a0423896973644771497bdc03eb99d5281615b51 hello.txt
98a390b9c8b5ba25e9444c8b5a487634795d7c72 src
02a9d16faa87c68bd6fc2af27cbe3714e53af272 src/hello.go
b7458566de2bf5e1011142ef5fe81ccaa4c9e73e
3f2157b609fb05814ba0a45cf40a452640e663c3 src
6009101760644963fee389fc730acc4c437edc8f
?f2482c1f31b320e28f0dea5c4e7c8263a0df8fec
$ git cat-file -p f2482c1f31b320e28f0dea5c4e7c8263a0df8fec
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
接收对象中: 100% (1/1), 109 字节 | 109.00 KiB/s, 完成.
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
$ git clone --filter=tree:0 \
https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/partial-clone-tutorial.git
$ cd partial-clone-tutorial
$ git rev-list --missing=print --objects HEAD
18990720b6e55a70ba9f9877213dad948e0973a2
e18cc4e7890e6ec832f683c1a0f58412b4a37964
2f7478bda13e73e1e1eaab6fae3d0dfd35e50b32
e7c719df0874ebd3b2ec02666d65879e986d537d
a0423896973644771497bdc03eb99d5281615b51 hello.txt
98a390b9c8b5ba25e9444c8b5a487634795d7c72 src
02a9d16faa87c68bd6fc2af27cbe3714e53af272 src/hello.go
?b7458566de2bf5e1011142ef5fe81ccaa4c9e73e
?6009101760644963fee389fc730acc4c437edc8f
$ git cat-file -p HEAD^^
tree 6009101760644963fee389fc730acc4c437edc8f
author yunhuai.xzy <yunhuai.xzy@alibaba-inc.com> 1631697940 +0800
committer yunhuai.xzy <yunhuai.xzy@alibaba-inc.com> 1631697940 +0800
first commit
$ git cat-file -p HEAD^
tree b7458566de2bf5e1011142ef5fe81ccaa4c9e73e
parent 2f7478bda13e73e1e1eaab6fae3d0dfd35e50b32
author yunhuai.xzy <yunhuai.xzy@alibaba-inc.com> 1631698032 +0800
committer yunhuai.xzy <yunhuai.xzy@alibaba-inc.com> 1631698032 +0800
add hello.go
-
git checkout
-
git clone
-
git switch
-
git archive
-
git merge
-
git reset
-
git log --stat
-
git cat-file
-
git diff
-
git blame
-
找到需要访问且在仓库中缺失的对象。
-
启动 git fetch进程,通过标准输入传递缺失的对象列表,批量下载缺失对象。
git rev-list --objects --missing=print v1.0.0..v2.0.0 | grep "^?"
git -c fetch.negotiationAlgorithm=noop \
fetch origin \
--no-tags \
--no-write-fetch-head \
--recurse-submodules=no \
--filter=blob:none \
--stdin
-
图片
-
视频
-
音频
-
美术、设计资源
-
模型
-
编译产物
-
...

