git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Atharva Raykar <raykar.ath@gmail.com>
To: Rostislav Krasny <rosti.bsd@gmail.com>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>, git@vger.kernel.org
Subject: Re: Why do submodules detach HEAD? (was Re: Incorrect and inconsistent End-Of-Line characters in .gitmodules ...)
Date: Fri, 06 Aug 2021 00:08:02 +0530	[thread overview]
Message-ID: <m2bl6bvit1.fsf@gmail.com> (raw)
In-Reply-To: <CANt7McE4N0wv5bik8tSNrdTs-mcL20cJPMP42iPtZqhUpKgirA@mail.gmail.com>


Rostislav Krasny <rosti.bsd@gmail.com> writes:

> On Wed, Jul 21, 2021 at 10:26 AM Atharva Raykar <raykar.ath@gmail.com> wrote:
>> [...]
>> We want to have idempotence, ie, for a particular revision that is
>> registered by our parent project, we want 'update' to give the same
>> outcome every time, and not be dependent on whatever the state of the
>> branch is. This way we ensure that for a particular commit in the
>> parent project, the submodules will be in the same state for every
>> system in the world, after an 'update' is run.
>
> All this is ok, but there could be other uses of sub-modules. Why not
> to make this behavior configurable?
>
> As a developer I may want to make new commits on those sub-modules and
> always work with latest versions of their particular branches. In the
> detached HEAD mode this is much harder to be done and also an error
> prone operation. Commits that are done in the detached HEAD state may
> easily be lost. [...]

Have you tried running 'submodule update --merge' or
'submodule update --rebase'? Those modes will not detach your
submodule's HEAD.

The Pro Git book has a section that explains a workflow that sounds
similar to what you describe:

https://git-scm.com/book/en/v2/Git-Tools-Submodules

Around halfway down the page, look for the heading "Working on a
Submodule". Does that fit your use case?

> [...] Google is full of questions about how this could be done, i.e. there
> is an essential demand of such a new behavior.

It would be nice if you can share a specific link that captures the
demand you are talking about. When I Googled about this behaviour, I got
a range of different kinds of results, without a clearly voiced demand.
If you can show an example that best represents this demand, the Git
developers here may be able to address it better.

  reply	other threads:[~2021-08-05 18:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15 21:55 Incorrect and inconsistent End-Of-Line characters in .gitmodules after "git submodule set-branch --branch <branch_name>" Rostislav Krasny
2021-07-16 19:38 ` brian m. carlson
2021-07-17 21:22   ` Rostislav Krasny
2021-07-21  7:26     ` Why do submodules detach HEAD? (was Re: Incorrect and inconsistent End-Of-Line characters in .gitmodules ...) Atharva Raykar
2021-07-21 22:42       ` Philippe Blain
2021-08-05 13:59       ` Rostislav Krasny
2021-08-05 18:38         ` Atharva Raykar [this message]
2021-07-17 17:05 ` Incorrect and inconsistent End-Of-Line characters in .gitmodules after "git submodule set-branch --branch <branch_name>" Torsten =?unknown-8bit?Q?B=C3=B6gershausen?=
2021-07-17 22:42   ` Rostislav Krasny
2021-07-18  5:32     ` Torsten =?unknown-8bit?Q?B=C3=B6gershausen?=

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2bl6bvit1.fsf@gmail.com \
    --to=raykar.ath@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=rosti.bsd@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).