git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Glen Choo <chooglen@google.com>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Tao Klerks" <tao@klerks.biz>, git <git@vger.kernel.org>,
	"Josh Steadmon" <steadmon@google.com>
Subject: Re: What does it mean to have multiple upstream tracking branches?
Date: Sun, 06 Mar 2022 13:54:36 -0800	[thread overview]
Message-ID: <xmqqzgm2vjab.fsf@gitster.g> (raw)
In-Reply-To: <kl6l4k4ek73o.fsf@chooglen-macbookpro.roam.corp.google.com> (Glen Choo's message of "Thu, 03 Mar 2022 14:24:11 -0800")

Glen Choo <chooglen@google.com> writes:

> Based on the discussion on that thread you mentioned, I don't think we
> have any such tests. I think the only way to get into this state is to
> manually modify the config.
>
> The only docs I could find on 'multiple values' are from
> Documentation/config/branch.txt:
>
>   branch.<name>.merge::
>     [...]
>     Specify multiple values to get an octopus merge.
>
> So I'd imagine a use case would be something like:
>
> - I'm preparing a feature on the branch 'topic'
> - It will get merged into 'origin/master'
> - The feature also depends on 'origin/other-topic'
>
> I'd have entries like:
>
> branch.topic.remote = origin
> branch.topic.merge = master
> branch.topic.merge = other-topic
>
> That way, if either 'origin/master' or 'origin/other-topic' changes, I
> can pull updates into 'topic' with "git pull".
>
> Not that I would ever _recommend_ someone to work like this though.
> Junio also wondered whether anyone uses this [1].
>
> [1] https://lore.kernel.org/git/xmqqbl2hw10h.fsf@gitster.g

I actually think the current octopus behaviour is a sensible one
(after all, that was what we envisioned how it would be used when we
did the mechanism long time ago).  If you have mutliple, say source
and docs, groups working for you and you are taking their work from
time to time, something like this:

    [branch "main"]
        remote = central-repo
        merge = sources
        merge = docs

would let your folks push into the central-repo, and a "git pull"
will help you advance your main branch that you'll publish later.

You can explain multiple .merge entries for such an integration
branch like I just did and I think such an explanation makes perfect
sense, but these are quite different from what we view as "upstream"
in the traditional sense.  In the setting illustrated here, yours is
the main integration repository, the center of the universe, and
those folks working in the 'sources' and 'docs' groups view yours as
their "upstream".

So, "what does it mean to have multiple branch.*.merge entries" has
a good answer: you are integrating from these contributors and these
entries are not your "upstream" in the usual sense---you do not even
push back to them.  Asking "what does it mean to have multiple
upstream" makes little sense, I would think.

Now, with the 'main' branch used in such a manner, if you did

   $ git branch --track=inherit topic main

and worked on the "topic" branch, you do not push back to either the
sources or docs of the central-repo, of course, but it is unclear if
you even want to "pull" to create octopus from these two branches at
the central-repo, which essentially duplicates the pull's you would
do on your 'main' branch.  I suspect that you'd rather want to merge
updates 'main' accumulated (or rebase on them).

The reason why I asked what Josh's plans are for the multiple .merge
entries in that thread [1] when the "--inherit" feature was being
invented was exactly about this point.  I wondered if last-one-wins
may make sense (and as the above octopus set-up tells us, it may
not), but if we want to keep "multiple .merge entries means an
integrator making octpus merges", then it may make sense not to copy
them when there are multiple with "--track=inherit", to avoid
spreading the "curious" nature of the branch like 'main' depicted
above.



  parent reply	other threads:[~2022-03-06 21:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03  6:16 What does it mean to have multiple upstream tracking branches? Tao Klerks
2022-03-03 12:54 ` Ævar Arnfjörð Bjarmason
2022-03-03 22:24   ` Glen Choo
2022-03-06 19:42     ` Ævar Arnfjörð Bjarmason
2022-03-07  6:16       ` Tao Klerks
2022-03-06 21:54     ` Junio C Hamano [this message]
2022-03-07  6:17       ` Tao Klerks
2022-03-07 12:12         ` Ævar Arnfjörð Bjarmason
2022-03-08 19:43           ` Josh Steadmon
2022-03-07  6:09     ` Tao Klerks

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=xmqqzgm2vjab.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=chooglen@google.com \
    --cc=git@vger.kernel.org \
    --cc=steadmon@google.com \
    --cc=tao@klerks.biz \
    /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).