3
使用Git 2.4.3(Fedora的22),我可以使用--depth
和-b
選項克隆回購:git的子模塊添加深度和分支選項
$ git clone --depth 1 -b release https://github.com/adobe-fonts/source-code-pro.git fonts/source-code-pro
Cloning into 'fonts/source-code-pro'...
remote: Counting objects: 114, done.
remote: Compressing objects: 100% (113/113), done.
remote: Total 114 (delta 1), reused 105 (delta 1), pack-reused 0
Receiving objects: 100% (114/114), 7.27 MiB | 2.85 MiB/s, done.
Resolving deltas: 100% (1/1), done.
Checking connectivity... done.
理論上git submodule add
應該支持相同的選項。不幸的是它似乎不工作:
$ mkdir foo
$ cd foo
$ git init
Initialized empty Git repository in /spare/local/arankine/foo/.git/
$ git submodule add --depth 1 -b release https://github.com/adobe-fonts/source-code-pro.git fonts/source-code-pro
Cloning into 'fonts/source-code-pro'...
remote: Counting objects: 35853, done.
remote: Compressing objects: 100% (5932/5932), done.
remote: Total 35853 (delta 35196), reused 30018 (delta 29921), pack-reused 0
Receiving objects: 100% (35853/35853), 12.95 MiB | 3.06 MiB/s, done.
Resolving deltas: 100% (35196/35196), done.
Checking connectivity... done.
fatal: Cannot update paths and switch to branch 'release' at the same time.
Did you intend to checkout 'origin/release' which can not be resolved as commit?
Unable to checkout submodule 'fonts/source-code-pro'
這樣做的目的是儘量減少這些字體,其分佈情況對回購的release
分支二進制對象所需的磁盤空間。只有最新的二進制文件是相關的。
這並不明顯如何使這項工作,請告知。
這是如何達到預期效果的?我認爲這與刪除'submodule add'中的'--depth'參數基本相同,還是我錯過了一些東西?爲了清楚起見,我編輯了這個問題來描述所需的結果。 – Alastair
@AlastairRankine的想法是使用子模塊添加--depth,*然後*嘗試和切換分支。 – VonC