# [PATCH] submodule documentation: Reorder introductory paragraphs

5 messages from 2015-05-22 to 2015-05-26. Participants: Stefan Beller, Philip Oakley, Junio C Hamano, Heiko Voigt.
Thread: https://gitlist.dev/t/39412

## Stefan Beller, 2015-05-22 19:38

Subject: [PATCH] submodule documentation: Reorder introductory paragraphs
Message-ID: <1432323527-26868-1-git-send-email-sbeller@google.com>
URL: https://gitlist.dev/e/1432323527-26868-1-git-send-email-sbeller%40google.com

```
It's better to start the man page with a description of what submodules
actually are instead of saying what they are not.

Reorder the paragraphs such that
the first short paragraph introduces the submodule concept,
the second paragraph highlights the usage of the submodule command,
the third paragraph giving background information,
and finally the fourth paragraph discusing alternatives such
as subtrees and remotes, which we don't want to be confused with.

This ordering deepens the knowledge on submodules with each paragraph.
First the basic questions like "How/what" will be answered, while the
underlying concepts will be taught at a later time.

Making sure it is not confused with subtrees and remotes is not really
enhancing knowledge of submodules itself, but rather painting the big
picture of git concepts, so you could also argue to have it as the second
paragraph. Personally I think this may confuse readers, specially
newcomers though.

Additionally to reordering the paragraphs, they have been slightly
reworded.

Signed-off-by: Stefan Beller <sbeller@google.com>
---

For now I used a part of Junios suggestion
    Submodules are not to be confused with remotes, which are other
    repositories of the same project;
    
I like the "are not to be confused" part, as they warn the reader
that there will be a paragraph not as concise but touching other
commands and topics.

 Documentation/git-submodule.txt | 50 ++++++++++++++++++-----------------------
 1 file changed, 22 insertions(+), 28 deletions(-)

diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index 2c25916..d126c86 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -25,22 +25,17 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-Submodules allow foreign repositories to be embedded within
-a dedicated subdirectory of the source tree, always pointed
-at a particular commit.
+This command will inspect, update and manage submodules.
 
-They are not to be confused with remotes, which are meant mainly
-for branches of the same project; submodules are meant for
-different projects you would like to make part of your source tree,
-while the history of the two projects still stays completely
-independent and you cannot modify the contents of the submodule
-from within the main project.
-If you want to merge the project histories and want to treat the
-aggregated whole as a single project from then on, you may want to
-add a remote for the other project and use the 'subtree' merge strategy,
-instead of treating the other project as a submodule. Directories
-that come from both projects can be cloned and checked out as a whole
-if you choose to go that route.
+Submodules allow you to keep another Git repository in a subdirectory
+of your repository. The other repository has its own history, which does not
+interfere with the history of the current repository. This can be used to
+have external dependencies such as libraries for example.
+
+When cloning or pulling a repository containing submodules however,
+these will not be checked out by default; the 'init' and 'update'
+subcommands will maintain submodules checked out and at
+appropriate revision in your working tree.
 
 Submodules are composed from a so-called `gitlink` tree entry
 in the main repository that refers to a particular commit object
@@ -51,19 +46,18 @@ describes the default URL the submodule shall be cloned from.
 The logical name can be used for overriding this URL within your
 local repository configuration (see 'submodule init').
 
-This command will manage the tree entries and contents of the
-gitmodules file for you, as well as inspect the status of your
-submodules and update them.
-When adding a new submodule to the tree, the 'add' subcommand
-is to be used.  However, when pulling a tree containing submodules,
-these will not be checked out by default;
-the 'init' and 'update' subcommands will maintain submodules
-checked out and at appropriate revision in your working tree.
-You can briefly inspect the up-to-date status of your submodules
-using the 'status' subcommand and get a detailed overview of the
-difference between the index and checkouts using the 'summary'
-subcommand.
-
+Submodules are not to be confused with remotes, which are other
+repositories of the same project; submodules are meant for
+different projects you would like to make part of your source tree,
+while the history of the two projects still stays completely
+independent and you cannot modify the contents of the submodule
+from within the main project.
+If you want to merge the project histories and want to treat the
+aggregated whole as a single project from then on, you may want to
+add a remote for the other project and use the 'subtree' merge strategy,
+instead of treating the other project as a submodule. Directories
+that come from both projects can be cloned and checked out as a whole
+if you choose to go that route.
 
 COMMANDS
 --------
-- 
2.4.1.233.g3f9b614.dirty

```

## Philip Oakley, 2015-05-22 21:18

Subject: Re: [PATCH] submodule documentation: Reorder introductory paragraphs
Message-ID: <FB89514A616F4190A54B09E0520A7ADD@PhilipOakley>
URL: https://gitlist.dev/e/FB89514A616F4190A54B09E0520A7ADD%40PhilipOakley
In-Reply-To: <1432323527-26868-1-git-send-email-sbeller@google.com>

```
From: "Stefan Beller" <sbeller@google.com>
> It's better to start the man page with a description of what 
> submodules
> actually are instead of saying what they are not.
>
> Reorder the paragraphs such that
> the first short paragraph introduces the submodule concept,
> the second paragraph highlights the usage of the submodule command,
> the third paragraph giving background information,
> and finally the fourth paragraph discusing alternatives such
> as subtrees and remotes, which we don't want to be confused with.
>
> This ordering deepens the knowledge on submodules with each paragraph.
> First the basic questions like "How/what" will be answered, while the
> underlying concepts will be taught at a later time.
>
> Making sure it is not confused with subtrees and remotes is not really
> enhancing knowledge of submodules itself, but rather painting the big
> picture of git concepts, so you could also argue to have it as the 
> second
> paragraph. Personally I think this may confuse readers, specially
> newcomers though.
>
> Additionally to reordering the paragraphs, they have been slightly
> reworded.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>
> For now I used a part of Junios suggestion
>    Submodules are not to be confused with remotes, which are other
>    repositories of the same project;
>
> I like the "are not to be confused" part, as they warn the reader
> that there will be a paragraph not as concise but touching other
> commands and topics.
>
> Documentation/git-submodule.txt | 50 
> ++++++++++++++++++-----------------------
> 1 file changed, 22 insertions(+), 28 deletions(-)
>
> diff --git a/Documentation/git-submodule.txt 
> b/Documentation/git-submodule.txt
> index 2c25916..d126c86 100644
> --- a/Documentation/git-submodule.txt
> +++ b/Documentation/git-submodule.txt
> @@ -25,22 +25,17 @@ SYNOPSIS
>
> DESCRIPTION
> -----------
> -Submodules allow foreign repositories to be embedded within
> -a dedicated subdirectory of the source tree, always pointed
> -at a particular commit.
> +This command will inspect, update and manage submodules.
>
> -They are not to be confused with remotes, which are meant mainly
> -for branches of the same project; submodules are meant for
> -different projects you would like to make part of your source tree,
> -while the history of the two projects still stays completely
> -independent and you cannot modify the contents of the submodule
> -from within the main project.
> -If you want to merge the project histories and want to treat the
> -aggregated whole as a single project from then on, you may want to
> -add a remote for the other project and use the 'subtree' merge 
> strategy,
> -instead of treating the other project as a submodule. Directories
> -that come from both projects can be cloned and checked out as a whole
> -if you choose to go that route.
> +Submodules allow you to keep another Git repository in a subdirectory
> +of your repository. The other repository has its own history, which 
> does not
> +interfere with the history of the current repository. This can be 
> used to
> +have external dependencies such as libraries for example.
> +
> +When cloning or pulling a repository containing submodules however,
> +these will not be checked out by default; the 'init' and 'update'
> +subcommands will maintain submodules checked out and at
> +appropriate revision in your working tree.
>
> Submodules are composed from a so-called `gitlink` tree entry
> in the main repository that refers to a particular commit object
> @@ -51,19 +46,18 @@ describes the default URL the submodule shall be 
> cloned from.
> The logical name can be used for overriding this URL within your
> local repository configuration (see 'submodule init').
>
> -This command will manage the tree entries and contents of the
> -gitmodules file for you, as well as inspect the status of your
> -submodules and update them.
> -When adding a new submodule to the tree, the 'add' subcommand
> -is to be used.  However, when pulling a tree containing submodules,
> -these will not be checked out by default;
> -the 'init' and 'update' subcommands will maintain submodules
> -checked out and at appropriate revision in your working tree.
> -You can briefly inspect the up-to-date status of your submodules
> -using the 'status' subcommand and get a detailed overview of the
> -difference between the index and checkouts using the 'summary'
> -subcommand.
> -
> +Submodules are not to be confused with remotes, which are other
> +repositories of the same project;

I said (22 May 2015 20:47):
"if a nice well understood explanatory phrase can be found " - I'm happy 
with yours. Many thanks

>                                        submodules are meant for
> +different projects you would like to make part of your source tree,
> +while the history of the two projects still stays completely
> +independent and you cannot modify the contents of the submodule
> +from within the main project.
> +If you want to merge the project histories and want to treat the
> +aggregated whole as a single project from then on, you may want to
> +add a remote for the other project and use the 'subtree' merge 
> strategy,
> +instead of treating the other project as a submodule. Directories
> +that come from both projects can be cloned and checked out as a whole
> +if you choose to go that route.
>
> COMMANDS
> --------
> -- 
> 2.4.1.233.g3f9b614.dirty
>
> --
Philip 

```

## Junio C Hamano, 2015-05-25 22:00

Subject: Re: [PATCH] submodule documentation: Reorder introductory paragraphs
Message-ID: <xmqqfv6k9v1x.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqfv6k9v1x.fsf%40gitster.dls.corp.google.com
In-Reply-To: <1432323527-26868-1-git-send-email-sbeller@google.com>

```
Stefan Beller <sbeller@google.com> writes:

>  DESCRIPTION
>  -----------
> +This command will inspect, update and manage submodules.
>  
> +Submodules allow you to keep another Git repository in a subdirectory
> +of your repository. The other repository has its own history,...

The first line somehow bothered me, so I took a random sample of
commands I often use:

    git log
       Shows the commit logs.

    git show
       Shows one or more objects (blobs, trees, tags and commits).

    git commit
       Stores the current contents of the index in a new commit along with a
       log message from the user describing the changes.

    git diff
       Show changes between the working tree and the index or a tree, changes
       between the index and a tree, changes between two trees, changes
       between two blob objects, or changes between two files on disk.

    git push
       Updates remote refs using local refs, while sending objects necessary
       to complete the given refs.

I _think_ what bothered me was "This command" (drawing the reaction
"eh, what other command are you going to talk about in the help page
for this command?").  Perhaps

    Inspects, updates and manages submodules.

may match the style of other help pages better.

On the other hand, I probably would not have felt such a strong
"strangeness" if it were described like this:

    This command can help you inspect, update, and manage
    submodules.

I haven't analized it enough to say why it is, but I suspect it has
something to do with (my own) perception that "git submodule" is not
very essential to do any of these things (i.e. .gitmodules is a very
simple text file), but is primarily a helpful wrapper.

The description of "git config", on which I have a similar
perception, seem to match ;-)

    git config
       You can query/set/replace/unset options with this command.

```

## Stefan Beller, 2015-05-26 17:53

Subject: Re: [PATCH] submodule documentation: Reorder introductory paragraphs
Message-ID: <CAGZ79kZHRRqKpSmnEfd7-UOL9QrPOhQYt7wsfaqGVTZkHc+mhQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAGZ79kZHRRqKpSmnEfd7-UOL9QrPOhQYt7wsfaqGVTZkHc%2BmhQ%40mail.gmail.com
In-Reply-To: <xmqqfv6k9v1x.fsf@gitster.dls.corp.google.com>

```
On Mon, May 25, 2015 at 3:00 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Stefan Beller <sbeller@google.com> writes:
>
>>  DESCRIPTION
>>  -----------
>> +This command will inspect, update and manage submodules.
>>
>> +Submodules allow you to keep another Git repository in a subdirectory
>> +of your repository. The other repository has its own history,...
>
> The first line somehow bothered me, so I took a random sample of
> commands I often use:
>
>     git log
>        Shows the commit logs.
>
>     git show
>        Shows one or more objects (blobs, trees, tags and commits).
>
>     git commit
>        Stores the current contents of the index in a new commit along with a
>        log message from the user describing the changes.
>
>     git diff
>        Show changes between the working tree and the index or a tree, changes
>        between the index and a tree, changes between two trees, changes
>        between two blob objects, or changes between two files on disk.
>
>     git push
>        Updates remote refs using local refs, while sending objects necessary
>        to complete the given refs.
>
> I _think_ what bothered me was "This command" (drawing the reaction
> "eh, what other command are you going to talk about in the help page
> for this command?").  Perhaps
>
>     Inspects, updates and manages submodules.
>
> may match the style of other help pages better.

Sounds much better than my patch.

>
> On the other hand, I probably would not have felt such a strong
> "strangeness" if it were described like this:
>
>     This command can help you inspect, update, and manage
>     submodules.
>
> I haven't analized it enough to say why it is, but I suspect it has
> something to do with (my own) perception that "git submodule" is not
> very essential to do any of these things (i.e. .gitmodules is a very
> simple text file), but is primarily a helpful wrapper.

My perception is that the submodule man page similar to the subtree
man page tries to explain an underlying concept as well. The other man
pages you quoted don't do that as the concepts are explained elsewhere(?)

As a side note: In the Gerrit test suite I use the JGit implementation of
the config command to write out .gitmodules files. So maybe `git submodule`
can be understood as a specialized form of `git config`.

>
> The description of "git config", on which I have a similar
> perception, seem to match ;-)
>
>     git config
>        You can query/set/replace/unset options with this command.
>

```

## Heiko Voigt, 2015-05-26 21:58

Subject: Re: [PATCH] submodule documentation: Reorder introductory paragraphs
Message-ID: <20150526215809.GA922@book.hvoigt.net>
URL: https://gitlist.dev/e/20150526215809.GA922%40book.hvoigt.net
In-Reply-To: <CAGZ79kZHRRqKpSmnEfd7-UOL9QrPOhQYt7wsfaqGVTZkHc+mhQ@mail.gmail.com>

```
On Tue, May 26, 2015 at 10:53:15AM -0700, Stefan Beller wrote:
> On Mon, May 25, 2015 at 3:00 PM, Junio C Hamano <gitster@pobox.com> wrote:
> > Stefan Beller <sbeller@google.com> writes:
> > On the other hand, I probably would not have felt such a strong
> > "strangeness" if it were described like this:
> >
> >     This command can help you inspect, update, and manage
> >     submodules.
> >
> > I haven't analized it enough to say why it is, but I suspect it has
> > something to do with (my own) perception that "git submodule" is not
> > very essential to do any of these things (i.e. .gitmodules is a very
> > simple text file), but is primarily a helpful wrapper.
> 
> My perception is that the submodule man page similar to the subtree
> man page tries to explain an underlying concept as well. The other man
> pages you quoted don't do that as the concepts are explained elsewhere(?)
> 
> As a side note: In the Gerrit test suite I use the JGit implementation of
> the config command to write out .gitmodules files. So maybe `git submodule`
> can be understood as a specialized form of `git config`.

I do not agree here. That view is too limited. Since in the case of e.g. 'git
submodule add‘ it does not only change the .gitmodules file but adds a gitlink
entry to the index, moves the database into .git/modules, ... .

And even though it is currently not doing much more it might in the
future. E.g. it might make sense to add a 'git submodule gc' command
which allows the user to purge unused submodule databases from the
.git/modules directory.

So I would say it is: "a helper" or "a tool" for submodules. Nothing less
nothing more. But on the other hand the same is true for other porcelain
commands like e.g. 'git commit'. If you take a look at gitcore-tutorial
you could also describe it as a wrapper for write-tree, commit-tree and
update-ref to create a commit. Yet the man page says: "Record changes to
the repository".

So I am not sure where to draw the line between wrapper and essential
command. As a user I would see it as quite essential since for adding a
submodule I would need to remember a couple of things:

  * clone the database into .git/modules
  * create the gitlink file
  * checkout the files to the desired directory
  * add the url to the .gitmodules file

So why not go with Junios first suggestion and lets drop the "This
command can help you..." and say: "Inspect, update and manage
submodules".

Cheers Heiko

```
