# Suggestion: git clone should warn if repository has submodules

3 messages from 2019-08-06 to 2019-08-06. Participants: Jason Sewall, Mateusz Loskot, Michal Suchánek.
Thread: https://gitlist.dev/t/51594

## Jason Sewall, 2019-08-06 14:03

Subject: Suggestion: git clone should warn if repository has submodules
Message-ID: <CADqa0D5wVWk2wa-raeVmCEhCqYznpba4TeUW_7UQOA0huR-RAg@mail.gmail.com>
URL: https://gitlist.dev/e/CADqa0D5wVWk2wa-raeVmCEhCqYznpba4TeUW_7UQOA0huR-RAg%40mail.gmail.com

```
Submodules are great, and I used them at work. The problem is, people
wind up cloning my repos without --recursive and then nothing works
for them, because  the submodules weren't populated and those
ultimately are needed to build my code.

I can see why --recursive isn't the default for git clone; you don't
want to just blindly follow whatever urls are in .gitmodules without
the user being aware of the possibility. That said, folks that are not
familiar with submodules (which seems to be most of the people I work
with!) wind up confused by this and don't know how to fix it.

While the burden is on the user and should remain so, it seems like
having git print out a message after cloning to the effect of "there
are submodules that are not populated, maybe you should look at them"
would go a long way to eliminating confusion for newer users. Yes, I
have put some documentation in my project that users should fetch the
submodules, but if possible, I'd like lower the number of times I have
to suggest that people RTFM.

Alternatively, is it preferable that I have my build system look at
the submodules and inform the user more helpfully? I'm curious to know
what, if any, is the recommended procedure.

Cheers,
Jason

```

## Mateusz Loskot, 2019-08-06 15:54

Subject: Re: Suggestion: git clone should warn if repository has submodules
Message-ID: <CABUeae9JhQ+JcNzYRMr40T2FTCJChYEz_riUr6Q1O5YO0uEDng@mail.gmail.com>
URL: https://gitlist.dev/e/CABUeae9JhQ%2BJcNzYRMr40T2FTCJChYEz_riUr6Q1O5YO0uEDng%40mail.gmail.com
In-Reply-To: <CADqa0D5wVWk2wa-raeVmCEhCqYznpba4TeUW_7UQOA0huR-RAg@mail.gmail.com>

```
On Tue, 6 Aug 2019 at 16:04, Jason Sewall <jasonsewall@gmail.com> wrote:
>
> Submodules are great, and I used them at work. The problem is, people
> wind up cloning my repos without --recursive and then nothing works
> for them, because  the submodules weren't populated and those
> ultimately are needed to build my code.

What you need is a simple document for your team that outlines the common
Git workflow or README.md in root directory of your repositories with
fat heading:

## Clone

ˋˋˋ
git clone --recursive ...
ˋˋˋ


A team in another company may require non-recursive clones by default
and warnings from git may be quite annoying. Given the fact there is not
one but may valid "my way"-s available, acceptable and supported by Git,
I think, babysitting behaviour is not quite aligned with its philosophy, is it?

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net

```

## Michal Suchánek, 2019-08-06 15:58

Subject: Re: Suggestion: git clone should warn if repository has submodules
Message-ID: <20190806175847.677319bf@kitsune.suse.cz>
URL: https://gitlist.dev/e/20190806175847.677319bf%40kitsune.suse.cz
In-Reply-To: <CABUeae9JhQ+JcNzYRMr40T2FTCJChYEz_riUr6Q1O5YO0uEDng@mail.gmail.com>

```
On Tue, 6 Aug 2019 17:54:20 +0200
Mateusz Loskot <mateusz@loskot.net> wrote:

> On Tue, 6 Aug 2019 at 16:04, Jason Sewall <jasonsewall@gmail.com> wrote:
> >
> > Submodules are great, and I used them at work. The problem is, people
> > wind up cloning my repos without --recursive and then nothing works
> > for them, because  the submodules weren't populated and those
> > ultimately are needed to build my code.  
> 
> What you need is a simple document for your team that outlines the common
> Git workflow or README.md in root directory of your repositories with
> fat heading:
> 
> ## Clone
> 
> ˋˋˋ
> git clone --recursive ...
> ˋˋˋ
> 
> 
> A team in another company may require non-recursive clones by default
> and warnings from git may be quite annoying. Given the fact there is not
> one but may valid "my way"-s available, acceptable and supported by Git,
> I think, babysitting behaviour is not quite aligned with its philosophy, is it?

It has warnings that you can disable globally or per-repository in
configuration to fit your workflow.

Thanks

Michal

```
