From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: "Aleksander Korzyński" <ak@akorzy.net>, git@vger.kernel.org
Subject: Re: Beyond Merge and Rebase: The Upstream Import Approach in Git
Date: Wed, 12 Jul 2023 08:37:14 -0700 [thread overview]
Message-ID: <xmqq7cr5uonp.fsf@gitster.g> (raw)
In-Reply-To: <71f7d816-b139-03ab-88fc-7552d65e4498@gmx.de> (Johannes Schindelin's message of "Wed, 12 Jul 2023 13:34:05 +0200 (CEST)")
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> I know this strategy well, having used it initially to maintain Git for
> Windows' patches on top of Git releases. I refer to it as `rebasing merge`
> strategy.
;-) Thanks. This did look familiar.
> o---o---o---o---o---o---o---o upstream/main
> \ \
> \ o'---o'---o'
> \ \
> o---o---o-------------S---o---o---o main
>
> A candidate to describe this in a commit range would be
> `upstream/main..main ^S^`, but you cannot pass that to `git rebase -i`,
> which expects a single upstream.
If "git rebase" is taught the `--ancestry-path` option and made to
pass it down to the underlying "which commits do I want to replay
and in what order" logic, it would be sufficient to help the above
topology, I would think. But offhand I do not know what other
rev-list options will become useful in different scenarios.
> So I switched to a different scheme instead that I dub "merging rebase".
> Instead of finishing the rebase with a merge, I start it with that merge.
> In your example, it would look like this:
>
> o---o---o---o---o upstream/main
> \ \
> o---o---o---M---o'---o'---o' main
>
> Naturally, `M` needs to be a merge that _must_ be made with `-s ours` in
> order to be "tree-same with upstream/main".
And this will let you say "rebase -i upstream/main" to further
rebase the most recent round of commits. That does look quite
natural.
> This strategy is not without problems, though, which becomes quite clear
> when you accept PRs that are based on commits prior to the most recent
> merging rebase (or rebasing merge, both strategies suffer from the same
> problem): the _next_ merging rebase will not necessarily find the most
> appropriate base commit, in particular when rebasing with
> `--rebase-merges`, causing unnecessary merge conflicts.
Even without rebasing merge or merging rebase, changes, which could
be useful if they were not based on a stale base, do happen, and it
is more effective to have the original authors of these changes to
update them to your most recent tree, than you dealing with them
yourself, for two reasons. There are more ICs than you alone, and
they are more familiar with their work.
In other words, isn't the real cause of the above that the workflow
is not taking advantage of the distributed development? "This PR
seems to solve the right problem, but it is based on an old version
of the code, please update?"
next prev parent reply other threads:[~2023-07-12 15:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 8:24 Beyond Merge and Rebase: The Upstream Import Approach in Git Aleksander Korzyński
2023-07-11 17:02 ` Junio C Hamano
2023-07-13 10:55 ` Aleksander Korzyński
2023-07-12 11:34 ` Johannes Schindelin
2023-07-12 15:37 ` Junio C Hamano [this message]
2023-07-12 20:27 ` Junio C Hamano
2023-07-14 10:56 ` Aleksander Korzyński
2023-08-01 9:17 ` Aleksander Korzyński
2023-07-14 10:06 ` Aleksander Korzyński
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=xmqq7cr5uonp.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=ak@akorzy.net \
--cc=git@vger.kernel.org \
/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).