Re: [BUG] - git rebase -i performs rebase when it shouldn't?

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

 



On Fri, Apr 09, 2010 at 03:35:42PM -0400, Eugene Sajine wrote:

> In case of this situation
> 
>        A  master
>         \
>          B  next
>           \
>            C  topic
> 
> 
> $ git rebase --onto master topic
> First, rewinding head to replay your work on top of it...
> fatal: Not a range.
> Nothing to do.
> 
> Which is OK.

I think this doesn't do quite what you thought. It's true there is
"nothing to do" as in "nothing to apply", but it _did_ in fact rewind
topic back to "master".

You seem to be thinking that

  git rebase --onto master topic

means "rebase everything from master to topic onto master". It doesn't.
That would be:

  git rebase master topic

or, if you are already on topic, just

  git rebase master

The "--onto" option takes an argument, which says "put the commits on
top of here, even though it was not the upstream base otherwise
specified". So what your command does is say "using the current branch
(which is topic), take everything built on top of topic (which is
nothing), and rebuild it on top of master".

So no, it's not a bug. Yes, it's a terrible interface. There is really
no reason IMHO for rebase to take a "which branch to operate on"
argument at all. It should just operate on HEAD, like merge does. If you
want to merge on a different branch, you "git checkout" that branch
first.

That would have made your error less likely, because you would have had
no reason to think you needed to say "topic" at all.

-Peff
--
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]