git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Rebase a whole tree from one commit to another?
@ 2009-05-15 19:38 Dirk Süsserott
  2009-05-16  7:35 ` Andreas Ericsson
  2009-05-16 13:49 ` Clemens Buchacher
  0 siblings, 2 replies; 3+ messages in thread
From: Dirk Süsserott @ 2009-05-15 19:38 UTC (permalink / raw)
  To: Git Mailing List

Hi alltogether.

Let's say I have the following history:

     | | | | branch-c
     | | | |
     | | |/  branch-b
     | | |
     | |/    branch-a
     | |
     |/
     | master

Now I checkout master, do some changes, and commit them to the master 
branch. Let's call that new-master:

    | new-master
    | | | | | branch-c
    | | | | |
    | | | |/  branch-b
    | | | |
    | | |/    branch-a
    | | |
    | |/
     \| master

I want to rebase my branches a, b, c to the new master. The clumsy way 
would be:

     git rebase new-master branch-a
     git rebase branch-a   branch-b
     git rebase branch-b   branch-c

The question is: Is there a way to rebase the whole tree (master -> 
branch-a -> branch-b -> branch-c) from master to new-master with a 
single command?


Cheers
   -- Dirk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Rebase a whole tree from one commit to another?
  2009-05-15 19:38 Rebase a whole tree from one commit to another? Dirk Süsserott
@ 2009-05-16  7:35 ` Andreas Ericsson
  2009-05-16 13:49 ` Clemens Buchacher
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Ericsson @ 2009-05-16  7:35 UTC (permalink / raw)
  To: Dirk Süsserott; +Cc: Git Mailing List

Dirk Süsserott wrote:
> Hi alltogether.
> 
> Let's say I have the following history:
> 
>     | | | | branch-c
>     | | | |
>     | | |/  branch-b
>     | | |
>     | |/    branch-a
>     | |
>     |/
>     | master
> 
> Now I checkout master, do some changes, and commit them to the master 
> branch. Let's call that new-master:
> 
>    | new-master
>    | | | | | branch-c
>    | | | | |
>    | | | |/  branch-b
>    | | | |
>    | | |/    branch-a
>    | | |
>    | |/
>     \| master
> 
> I want to rebase my branches a, b, c to the new master. The clumsy way 
> would be:
> 
>     git rebase new-master branch-a
>     git rebase branch-a   branch-b
>     git rebase branch-b   branch-c
> 
> The question is: Is there a way to rebase the whole tree (master -> 
> branch-a -> branch-b -> branch-c) from master to new-master with a 
> single command?
> 

No. You could merge all the branches that forked from master, rebase
the merged branch to new-master and then undo the merge-commit though,
but that would still mean three commands (and most likely some
conflict resolution). Assuming you have (a lot) more than three
branches, this might be a way forward for you.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Register now for Nordic Meet on Nagios, June 3-4 in Stockholm
 http://nordicmeetonnagios.op5.org/

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Rebase a whole tree from one commit to another?
  2009-05-15 19:38 Rebase a whole tree from one commit to another? Dirk Süsserott
  2009-05-16  7:35 ` Andreas Ericsson
@ 2009-05-16 13:49 ` Clemens Buchacher
  1 sibling, 0 replies; 3+ messages in thread
From: Clemens Buchacher @ 2009-05-16 13:49 UTC (permalink / raw)
  To: Dirk Süsserott; +Cc: Git Mailing List

On Fri, May 15, 2009 at 09:38:53PM +0200, Dirk Süsserott wrote:
>
>     git rebase new-master branch-a
>     git rebase branch-a   branch-b
>     git rebase branch-b   branch-c
>

You probably want something like

	git rebase new-master branch-a
	git rebase --onto branch-a branch-a@{1} branch-b
	git rebase --onto branch-b branch-b@{1} branch-c

instead, because if you have any conflicts during rebase, the rebased
commits will no longer be recognized as identical, causing even more
conflicts in the following rebases.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-05-16 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-15 19:38 Rebase a whole tree from one commit to another? Dirk Süsserott
2009-05-16  7:35 ` Andreas Ericsson
2009-05-16 13:49 ` Clemens Buchacher

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).