On Tue, 10 May 2016, Richard Guy Briggs wrote:
> On 16/05/10, Robert P. J. Day wrote:
> > SCENARIO: most recent 5 commits on a clean, linear history branch:
> >
> > ... X <--- A <--- B <--- C <--- D <--- E (HEAD)
> >
> > suddenly, i wish i hadn't done A, but want to leave the more
> > recent commits on that branch (rebased of course).
> >
> > pretty sure i can do an interactive rebase, as in:
> >
> > $ git rebase -i X
>
> In fact, I've done this before and lost a merge in the process due
> to the interactive option, so I think you might need to do:
>
> git rebase -i A~
>
> > oh, wait, can't i just rebase B onto X? effectively, i want to
> > reproduce the work from B to E as if it originated at X; isn't
> > that just a regular rebase? thoughts?
>
> I've never done it, but I was re-reading that manpage recently and I
> think you can just do:
>
> git rebase --onto X B E
yup, that's what i was thinking ... i've never tried it before but
it seems that that would be a fairly common thing people would want to
do, and should be easy as long as you have a clean and linear history.
and in my case, i can guarantee there would be no merge conflicts.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================