Using git 2.4.3 (Fedora 22), I can clone a repo using the --depth
and -b
options:
$ 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.
In theory git submodule add
should support the same options. Unfortunately it doesn't seem to work:
$ 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'
The intention here is to minimize the disk space required for these fonts, which are distributed as binary objects on the release
branch of that repo. Only the latest binaries are relevant.
It's not obvious to me how to make this work, please advise.