<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/Documentation/git-submodule.txt, branch v2.0.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.0.0</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.0.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-04-02T21:15:36Z</updated>
<entry>
<title>Revert "submodule: explicit local branch creation in module_clone"</title>
<updated>2014-04-02T21:15:36Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-04-02T21:15:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d851ffb91f8c25f51b284cd4e849757d656de0d1'/>
<id>urn:sha1:d851ffb91f8c25f51b284cd4e849757d656de0d1</id>
<content type='text'>
This reverts commit 23d25e48f5ead73c9ce233986f90791abec9f1e8, as it is
broken for users who haven't opted into the new feature of checking
out submodule.*.branch with update mode set to checkout.
</content>
</entry>
<entry>
<title>Revert "Merge branch 'wt/doc-submodule-name-path-confusion-2'"</title>
<updated>2014-04-01T18:52:37Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-04-01T18:52:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=edac360bdd35eacfb11005583aa7736d72a063bd'/>
<id>urn:sha1:edac360bdd35eacfb11005583aa7736d72a063bd</id>
<content type='text'>
This reverts commit 00d4ff1a69883e24b095f45251d99143b5bc0320, reversing
changes made to d3badc6eb0961382788c2670129d5ee133d079fd.
</content>
</entry>
<entry>
<title>Merge branch 'wt/doc-submodule-name-path-confusion-2'</title>
<updated>2014-03-31T23:31:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-31T23:31:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=00d4ff1a69883e24b095f45251d99143b5bc0320'/>
<id>urn:sha1:00d4ff1a69883e24b095f45251d99143b5bc0320</id>
<content type='text'>
* wt/doc-submodule-name-path-confusion-2:
  doc: submodule.*.branch config is keyed by name
</content>
</entry>
<entry>
<title>Merge branch 'wt/doc-submodule-name-path-confusion-1'</title>
<updated>2014-03-31T23:31:14Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-31T23:31:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d3badc6eb0961382788c2670129d5ee133d079fd'/>
<id>urn:sha1:d3badc6eb0961382788c2670129d5ee133d079fd</id>
<content type='text'>
* wt/doc-submodule-name-path-confusion-1:
  doc: submodule.* config are keyed by submodule names
</content>
</entry>
<entry>
<title>doc: submodule.*.branch config is keyed by name</title>
<updated>2014-03-27T22:01:42Z</updated>
<author>
<name>W. Trevor King</name>
<email>wking@tremily.us</email>
</author>
<published>2014-03-27T21:06:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7c15fe92acf267f7538d8f4bece33d6bc8409cd7'/>
<id>urn:sha1:7c15fe92acf267f7538d8f4bece33d6bc8409cd7</id>
<content type='text'>
Ever since 941987a5 (git-submodule: give submodules proper names,
2007-06-11) introduced the ability to move a submodule from one path
to another inside its superproject tree without losing its identity,
we should have consistently used submodule.&lt;name&gt;.* to access
settings related to the named submodule.

Signed-off-by: W. Trevor King &lt;wking@tremily.us&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>doc: submodule.* config are keyed by submodule names</title>
<updated>2014-03-27T21:58:37Z</updated>
<author>
<name>W. Trevor King</name>
<email>wking@tremily.us</email>
</author>
<published>2014-03-27T21:06:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=15d64936d4be1e11085e21de6615742298276ab6'/>
<id>urn:sha1:15d64936d4be1e11085e21de6615742298276ab6</id>
<content type='text'>
Ever since 941987a5 (git-submodule: give submodules proper names,
2007-06-11) introduced the ability to move a submodule from one path
to another inside its superproject tree without losing its identity,
we should have consistently used submodule.&lt;name&gt;.* to access
settings related to the named submodule.

Reported-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: W. Trevor King &lt;wking@tremily.us&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jl/doc-submodule-update-checkout'</title>
<updated>2014-03-14T21:26:58Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-14T21:26:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d73e6160031e1753c81cf0d72b0f9525cf93dca0'/>
<id>urn:sha1:d73e6160031e1753c81cf0d72b0f9525cf93dca0</id>
<content type='text'>
Add missing documentation for "submodule update --checkout".

* jl/doc-submodule-update-checkout:
  submodule update: consistently document the '--checkout' option
</content>
</entry>
<entry>
<title>submodule update: consistently document the '--checkout' option</title>
<updated>2014-02-28T23:34:36Z</updated>
<author>
<name>Jens Lehmann</name>
<email>Jens.Lehmann@web.de</email>
</author>
<published>2014-02-28T22:41:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=893a9764dc5e6d5d3432a47f595ffffade1edd9c'/>
<id>urn:sha1:893a9764dc5e6d5d3432a47f595ffffade1edd9c</id>
<content type='text'>
Commit 322bb6e12f (add update 'none' flag to disable update of submodule
by default) added the '--checkout' option to "git submodule update" but
forgot to explicitly document it in synopsis, usage string and man page
(It is only mentioned implicitly in the man page). In 23d25e48 (submodule:
explicit local branch creation in module_clone) the synopsis of the man
page was updated, but the "OPTIONS" section of the man page and the usage
string of the git-submodule script still do not mention the '--checkout'
option.

Fix that by documenting this option in usage string and the "OPTIONS"
section of man page too. While at it group the update-mode options into
a single set in the usage string.

Reported-by: Matthijs Kooijman &lt;matthijs@stdin.nl&gt;
Signed-off-by: Jens Lehmann &lt;Jens.Lehmann@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Documentation: describe 'submodule update --remote' use case</title>
<updated>2014-02-24T22:35:52Z</updated>
<author>
<name>W. Trevor King</name>
<email>wking@tremily.us</email>
</author>
<published>2014-01-26T20:45:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9937e65d8835ee6c026892de48f993d7a524a00f'/>
<id>urn:sha1:9937e65d8835ee6c026892de48f993d7a524a00f</id>
<content type='text'>
Make it clear that there is no implicit floating going on; --remote
lets you explicitly integrate the upstream branch in your current
HEAD (just like running 'git pull' in the submodule).  The only
distinction with the current 'git pull' is the config location and
setting used for the upstream branch, which is hopefully clear now.

Signed-off-by: W. Trevor King &lt;wking@tremily.us&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>submodule: explicit local branch creation in module_clone</title>
<updated>2014-02-24T22:35:48Z</updated>
<author>
<name>W. Trevor King</name>
<email>wking@tremily.us</email>
</author>
<published>2014-01-26T20:45:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=23d25e48f5ead73c9ce233986f90791abec9f1e8'/>
<id>urn:sha1:23d25e48f5ead73c9ce233986f90791abec9f1e8</id>
<content type='text'>
The previous code only checked out branches in cmd_add.  This commit
moves the branch-checkout logic into module_clone, where it can be
shared by cmd_add and cmd_update.  I also update the initial checkout
command to use 'reset' to preserve branches setup during module_clone.

With this change, folks cloning submodules for the first time via:

  $ git submodule update ...

will get a local branch instead of a detached HEAD, unless they are
using the default checkout-mode updates.  This is a change from the
previous situation where cmd_update always used checkout-mode logic
(regardless of the requested update mode) for updates that triggered
an initial clone, which always resulted in a detached HEAD.

This commit does not change the logic for updates after the initial
clone, which will continue to create detached HEADs for checkout-mode
updates, and integrate remote work with the local HEAD (detached or
not) in other modes.

The motivation for the change is that developers doing local work
inside the submodule are likely to select a non-checkout-mode for
updates so their local work is integrated with upstream work.
Developers who are not doing local submodule work stick with
checkout-mode updates so any apparently local work is blown away
during updates.  For example, if upstream rolls back the remote branch
or gitlinked commit to an earlier version, the checkout-mode developer
wants their old submodule checkout to be rolled back as well, instead
of getting a no-op merge/rebase with the rolled-back reference.

By using the update mode to distinguish submodule developers from
black-box submodule consumers, we can setup local branches for the
developers who will want local branches, and stick with detached HEADs
for the developers that don't care.

Testing
=======

In t7406, just-cloned checkouts now update to the gitlinked hash with
'reset', to preserve the local branch for situations where we're not
on a detached HEAD.

I also added explicit tests to t7406 for HEAD attachement after
cloning updates, showing that it depends on their update mode:

* Checkout-mode updates get detached HEADs
* Everyone else gets a local branch, matching the configured
  submodule.&lt;name&gt;.branch and defaulting to master.

The 'initial-setup' tag makes it easy to reset the superproject to a
known state, as several earlier tests commit to submodules and commit
the changed gitlinks to the superproject, but don't push the new
submodule commits to the upstream subprojects.  This makes it
impossible to checkout the current super master, because it references
submodule commits that don't exist in the upstream subprojects.  For a
specific example, see the tests that currently generate the
'two_new_submodule_commits' commits.

Documentation
=============

I updated the docs to describe the 'submodule update' modes in detail.
The old documentation did not distinguish between cloning and
non-cloning updates and lacked clarity on which operations would lead
to detached HEADs, and which would not.  The new documentation
addresses these issues while updating the docs to reflect the changes
introduced by this commit's explicit local branch creation in
module_clone.

I also add '--checkout' to the usage summary and group the update-mode
options into a single set.

Signed-off-by: W. Trevor King &lt;wking@tremily.us&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
