Is a full clone the only way the submodule is to add a branch?

I want to add a submodule that refers to a specific (non-leading) branch. The following will only capture the leading branch from behind --depth=1, so the team will inevitably fail;

git submodule add -b myBranch --depth=1 git@host.com:some/large/repo

Since it submodule adddoesn't support --single-branch, does this mean that my only option is to clone the entire repo?

+4
source share
1 answer

From the documentation git-clone:

- depth depth

Create a small clone with a story truncated to the specified

- [no-] one branch

, , --branch, . --depth, , -no-single-branch . . HEAD - -single-branch, .

, git submodule add git clone, --single-branch. , git submodule add -b git clone.

( - git submodule add) git clone , ,

git clone -b myBranch --single-branch --depth=1 git@host.com:some/large/repo large_repo
git submodule add -b myBranch git@host.com:some/large/repo large_repo

git []

...

- . , URL. Git, .

+2

All Articles