There are two, maybe three, points here. 

Firstly determine which type of submodules you are using - in particular is 
the submodule's object store part of the main repository, or is it 
separately held in the submodule - it's an implementation detail but 
moderately relevant here. I.e. you need to know where the sub-module's data 
is stored. - what version/os of Git are you on? there has been a lot of 
work on sub-modules that have updated the expectations.

Second, do you need to have the sub-module master branch available for 
other work? If you do you will have the data locally leaving you with a 
problem.

Otherwise look at the 'refspec' for cloning the sub-module - you only want 
to have the secondary branch's details cloned, not everything!

The sub-module ID will be for the secondary branch at the commit you want. 
You may even want to only use a shallow clone with depth=1 when cloning the 
submodule.

There is more about cleaning up the repo if you already have too much in 
your object store and its 'packs'

Philip



On Tuesday, March 15, 2022 at 6:25:25 PM UTC [email protected] wrote:

> New to git.
>
> We are trying to figure out how we can exclude the master branch sources 
> from a submodule commit ID. We have a repo that has a submodule to another 
> repo but the commit reference is to a branch that only has partial 
> information of the branch.
>
> We are finding out that if we clone the repo, we can go to that submodule 
> without any network connection to the company and extract the master branch 
> of that submodule exposing all the components we already hid behind the 
> different branch.
>
> Anyone know a solution for this, exclude the master branch sources from a 
> submodule commit ID?
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/02c1bf17-6c03-4377-9255-2585de9d40afn%40googlegroups.com.

Reply via email to