Re: Rebasing a branch that contains merges

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]