On Thu, Feb 25, 2016 at 9:54 AM, Alter Depp <Alter.Depp@xxxxxx> wrote: > I would like to do a shallow clone of a submodule like this: > $ git submodule add --branch master --single-branch --depth 5 repo dir > but it doesn't work. I think '--single-branch' is not yet implemented for > submodules. > > With the clone command it works: > $ git clone --branch master --single-branch --depth 5 repo dir > > Is it possible to do something like this with a submodule? Shallow submodules are not quite well supported. Example: $ git clone --depth 2 --recurse-submodules <url> the depth argument applies to the main repository, and currently it is passed on to the submodules if any. The '--depth 2' suggests that you can operate on the 2 topmost revisions of the super project flawlessly, so if the submodule pointer in the superproject is advanced more than 2 commits between these 2 commits, you're missing content. So in this case you don't want to pass on the depth literally to the submodule, but rather find out which commits are referenced from the superproject and make sure those are included in the submodule. In your case of adding a submodule as a shallow repo, this problem is not there. However 'git sub add' will eventually call 'git clone' to get that submodule and '--single-branch' is implied by the existance of the '--depth' argument there. See the man page of git clone for that. So 'git submodule add --depth 5 <url>' should do what you'd expect. Unfortunately you cannot specify '--branch=master' though yet. Stefan > > Stefan > > > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html