Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Peter Krefting <peter@softwolves.pp.se>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: How to rebase and rename?
Date: Wed, 3 Feb 2010 04:48:06 -0500	[thread overview]
Message-ID: <20100203094806.GB23956@coredump.intra.peff.net> (raw)
In-Reply-To: <alpine.DEB.2.00.1002030958380.17444@ds9.cixit.se>

On Wed, Feb 03, 2010 at 10:05:10AM +0100, Peter Krefting wrote:

> If I have a repository with a topic branch that is published, and
> that I want to rebase and republish under a new name, is there an
> easy way of doing that?
> [...]
> Currently, I do something along the lines of:
> 
>  git branch topic-2 topic-1
>  git rebase master topic-2
> 
> but that feels wrong as it creates the "topic-2" branch pointing the
> the wrong way first. Is there a way to eliminate that step?

No, I think that is the best way to do it. Since the creation of topic-2
is happening in your (presumably) private repo, it is not a big deal for
it to exist in an unintertesting state for a few seconds.

If you really cared, you could do the work on a detached HEAD and then
assign the result to a new branch, but that is even more typing:

  git checkout topic-1^0
  git rebase master
  git checkout -b topic-2

It also causes git to do slightly more work. In your example, the branch
creation is O(1), then rebase resets back to master and applies each
commit in topic-1 in turn. In mine, we actually reset the checkout to
topic-1, then reset it to master, and then apply the commits. Not that
it probably matters unless you have some enormous repository.

-Peff

      reply	other threads:[~2010-02-03  9:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03  9:05 How to rebase and rename? Peter Krefting
2010-02-03  9:48 ` Jeff King [this message]

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=20100203094806.GB23956@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=peter@softwolves.pp.se \
    /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