From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <junkio@cox.net>
Subject: Re: Rebasing a branch that contains merges
Date: Mon, 19 Feb 2007 10:48:23 +0000 [thread overview]
Message-ID: <200702191048.24091.andyparkins@gmail.com> (raw)
In-Reply-To: <7vmz3a8p6g.fsf@assigned-by-dhcp.cox.net>
On Monday 2007 February 19 09:36, Junio C Hamano wrote:
> > This is an unreasonable thing to expect a version control
> > system to be able to do ...
>
> I do not necessarily think so. If you have this:
Sorry; by "unreasonable", I meant "unreasonable to expect that your VCS is
clever enough to do it". It's an offhand compliment to git; I can't imagine
any other VCS is capable of this sort of thing, so the discussion wouldn't
even happen.
> However, you have to be careful. The thing is, you do not want
> to 'rebase' a merge if the other branch came from somewhere not
> under your control. If 'a', 'o', 'X', 'Y' and 'M' are under
> your control, and 'x' are from somebody else's tree in the
> following picture:
Absolutely. We can take that as a given though can't we? That is always true
for a rebase, irrespective of whether its got merges in the branch. As your
diagrams show, dealing with merges during a rebase just makes things more
complicated in that you can now have one parent of the merge being rebasable
and one not.
My original query should have stated my assumption: that all the merged
branches are mine to rebase as I see fit.
> and if you say "rebase --onto X a Y", it is not useful to rebase
> 'x' when you want to rewrite your history. They are somebody
> else's history, and other people might have got it already, too.
> Even if you _could_ rebase them, you would rather not.
Coo; this obviously makes things much harder. What if there are further
merges on the merged branches? It's going to get hard to specify which of
the merge branches you want to rebase and which you don't.
> the tool which parents of merges you would want to rebase and
> which ones you do not want to touch but recreate the merge by
> merging with your rebased branches again. In the above 'ideal',
So - rebase would need some sort of language to tell it which branch to
favour.
$ git checkout branch-with-merges
$ git rebase other-branch
rebase: Aborted because commit 123456abcdef has multiple parents:
rebase: - 123456789abcdef
rebase: - abcdef123456789
$ git rebase --include-parent abcdef123456789 other-branch
Yuck. I've made myself ill now. It's not going to be pretty is it?
For now, I wanted to make git-rebase just abort if there are merge commits in
the rebased branch, I had a quick look at git-rebase.sh to see if I could
find the place were this could be detected and have got lost. So I've failed
again :-)
At the moment, git-rev-list --no-merges is used. I don't think that, that's
the correct thing to do. That just filters out the merge. Doesn't that risk
loss of history as I showed in my first email?
Andy
--
Dr Andy Parkins, M Eng (hons), MIEE
andyparkins@gmail.com
next prev parent reply other threads:[~2007-02-19 10:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-19 9:12 Rebasing a branch that contains merges Andy Parkins
2007-02-19 9:36 ` Junio C Hamano
2007-02-19 10:48 ` Andy Parkins [this message]
2007-02-19 14:39 ` A.J. Rossini
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=200702191048.24091.andyparkins@gmail.com \
--to=andyparkins@gmail.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.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).