From: Jens Lehmann <Jens.Lehmann@web.de>
To: Robert Dailey <rcdailey.lists@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Cc: Git <git@vger.kernel.org>, Heiko Voigt <hvoigt@hvoigt.net>
Subject: Re: Subtree with submodule inside?
Date: Wed, 06 Aug 2014 22:14:35 +0200 [thread overview]
Message-ID: <53E28CAB.4040800@web.de> (raw)
In-Reply-To: <CAHd499AmY+EYXAK8h_oYiOn-amnNrE1+a7qsQ4x7bCOVsJDxcw@mail.gmail.com>
Am 06.08.2014 um 20:18 schrieb Robert Dailey:
> On Wed, Aug 6, 2014 at 12:51 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> My knee-jerk reaction would be "subtree would break submodules
>> badly, don't use it" ;-).
>>
>> After all, I invented subtree merge as an ugly interim workaround
>> before submodule subsystem got into a usable shape, hoping that new
>> projects can use submodules without resorting to subtree merges.
>
> (Sorry Junio, I forgot to "Reply all" and accidentally sent this only
> to you. Resending to group)
>
> Hi Junio. I agree it certainly does sound evil and defeats the purpose
> of the goal of ultimately creating a simple workflow :)
>
> Could you go over how you feel the submodule system got into "usable"
> shape? It still seems to still have all of the problems I still hate:
>
> * If you branch a production branch to implement a feature that also
> impacts the submodule, you need to branch the submodule. There is no
> easy interface for this and rather clumbsy, especially if people are
> using GUI tools like SourceTree (most of the people on my team are).
There were thoughts about having "git branch" optionally create a
branch in the submodule too. But in a lot of real world scenarios
that won't help because the same branch name won't necessarily make
sense in superproject and submodule at the same time, so you'd have
to create different branches anyway. But if it makes a significant
amount of users happy, I think adding --recurse-submodules to "git
branch" might make sense to make life easier for them.
I do not know SourceTree myself, but do you have any ideas you'd
like to share how you could envision to make branching less tedious?
I hope it at least shows you that there are modifications inside the
submodule while examining the superproject and provides an easy way
to start a new instance inside the submodule to commit the changes
there? Otherwise it'd make life unnecessarily hard for you.
> * Pull requests do not include submodule changes in the review (we use
> Atlassian Stash). So 1 pull request per submodule has to be performed
> and they have to be merged in the appropriate order.
Which seems to be a chore in your scenario, but is just the Right
Thing to do when someone else maintains the submodule. Given the
danger of a rebase in the submodule pulling away the commit recorded
in the superproject it is considered best practice to always merge
in the submodule into a never-to-be-rebased branch first before
committing the superproject. But I agree it is twice the work.
> * Submodules complicate an otherwise beautiful workflow that Git is
> supposed to provide (branching) in many ways, and also there are
> restrictions on the order in which you modify parent repository vs
> submodule.
I cannot remember anyone coming up with a better workflow when
having distinct repos (superproject and submodule). Subtree on the
other hand has other issues (like you can easily forget to push a
fix to a subtree to its upstream, which is something submodules
make you aware of). And the submodule workflow is as beautiful as
ever if you consider superproject and submodule different repos
(which they are), and then it is obvious that you have to do
everything twice ;-)
But I do have the impression that a lot of third party tools are
still rather submodule ignorant and of not much help there.
> If I'm going to put my common code in a separate module for the
> purposes of splitting apart projects that depend on the common code, I
> want the workflows that Git provides to remain simple. Subtrees seem
> to do that, you just sync with the common repo every now and then.
If you are only interested in single "from upstream into my repo"
workflow and don't care much about pushing your local changes back
to the common code repo, subtrees are easier to use than submodules.
But if you need or want to contribute your changes back, I believe
submodules gain the upper hand rather quickly.
But back to your original question: I do no see a way to import
another repo using a submodule via subtree either. You'd have to
consistently use submodules to make that work (even if that means
that you'll have three repos to think about, one being embedded in
the other).
next prev parent reply other threads:[~2014-08-06 20:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-06 17:20 Subtree with submodule inside? Robert Dailey
2014-08-06 17:51 ` Junio C Hamano
2014-08-06 18:18 ` Robert Dailey
2014-08-06 20:14 ` Jens Lehmann [this message]
2014-08-06 22:08 ` Jonathan Nieder
2014-08-06 23:32 ` Junio C Hamano
2014-08-06 23:51 ` Jonathan Nieder
2014-08-07 16:07 ` Heiko Voigt
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=53E28CAB.4040800@web.de \
--to=jens.lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hvoigt@hvoigt.net \
--cc=rcdailey.lists@gmail.com \
/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).