[英]git shallow clone along with branch
我必須處理包含一些二進制文件的git repo。
如果有人可以向我解釋一下,我將不勝感激
>git clone --depth 1 -- ssh://git/foo/bar.git test_d
Cloning into 'test_d'...
remote: Counting objects: 289, done.
remote: Compressing objects: 100% (268/268), done.
remote: Total 289 (delta 111), reused 120 (delta 19)
Receiving objects: 100% (289/289), 1.95 MiB | 519 KiB/s, done.
Resolving deltas: 100% (111/111), done.
>git clone --depth 1 -b master -- ssh://git/foo/bar.git test_db
Cloning into 'test_db'...
remote: Counting objects: 5980, done.
remote: Compressing objects: 100% (1777/1777), done.
remote: Total 5980 (delta 3868), reused 5657 (delta 3660)
Receiving objects: 100% (5980/5980), 36.50 MiB | 1.10 MiB/s, done.
Resolving deltas: 100% (3868/3868), done.
>git clone -b master -- ssh://git/foo/bar.git test_b
Cloning into 'test_b'...
remote: Counting objects: 6953, done.
remote: Compressing objects: 100% (1779/1779), done.
remote: Total 6953 (delta 4419), reused 6946 (delta 4417)
Receiving objects: 100% (6953/6953), 57.25 MiB | 1.15 MiB/s, done.
Resolving deltas: 100% (4419/4419), done.
也就是說,為什么在傳遞-b時似乎正在改變--depth的行為?
嗯,我想我在以下相關問題中找到了解決方案: 使用Git和Mercurial進行部分克隆
> md test_foo
> cd test_foo
> git init
> git remote add origin ssh://git/foo/bar.git
> git config --local remote.origin.fetch +refs/heads/master:refs/remotes/origin/master
> git pull --depth 1
remote: Counting objects: 289, done.
remote: Compressing objects: 100% (268/268), done.
remote: Total 289 (delta 111), reused 120 (delta 19)
Receiving objects: 100% (289/289), 1.95 MiB | 496 KiB/s, done.
Resolving deltas: 100% (111/111), done.
From ssh://git/foo/bar.git
* [new branch] master -> origin/master
但這似乎不是解決方案 ; /
淺克隆存儲庫
git clone --depth [提交的數量] [遠程的URL]
克隆單個分支
git clone [url_of_remote] --branch [branch_name] --single-branch
http://www.sitepoint.com/managing-huge-repositories-with-git/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.