Re: [BUG] - git rebase -i performs rebase when it shouldn't?
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Apr 12, 2010, 15:47 UTC
- Message-ID
- <4BC3407C.10701@viscovery.net>
- In-Reply-To
- <w2t76c5b8581004120828p8e1e5c49m7bcc53c8c3e68d06@mail.gmail.com>
Am 4/12/2010 17:28, schrieb Eugene Sajine:
Show 15 quoted lines
> On Mon, Apr 12, 2010 at 11:13 AM, Johannes Sixt <j.sixt@viscovery.net> wrote: >> Am 4/12/2010 16:09, schrieb Eugene Sajine: >>> esajine@ESAJINEWWW /c/git_repos/test2 (topic) >>> $ git rebase master >>> Current branch topic is up to date. >>> <======= Really? Topic is actually based on next – what does this "up >>> to date" mean?? >> >> Why should rebase bother? The difference between master and topic are >> *two* commits. Since these two are already on top of master in linear >> history, you get no advantage by doing a rebase operation. Therefore, you >> see "already up to date". > > You lost me completely... > Rebase means change the base of the commit, change the fork point.
Rebase is meant to change the fork point for a history like this:
--o--o--A--o--o--B <-- master
\
o
\
o <-- topictopic forks from master at commit A; you use rebase to create history that looks like this:
--o--o--A--o--o--B <-- master
\
o
\
o <-- topic(OK, you knew that already.)
> Current fork point for topic is next. I want it to be master. What is > up to date here???
You are already in the second situation above. The fact that you labeled one commit "next" in between, like this:
--o--o--A--o--o--B <-- master
\
o <-- next
\
o <-- topicdoes not change the meaning of the command "git rebase master" in the slightest: topic is "up to date" with respect to master.
Show 7 quoted lines
> The message is poorly worded for sure. > > I know that the form i have to use is: > > git rebase --onto master next topic > > but it is just because topic is not direct descendant of master, isn't it?
Watch out the wording that you use: "descendant of" has a well-defined meaning in git, in particular, topic *is* a direct descendant of master.
What you wanted to say is: "but it is just because I have accidentally begun to commit 'topic' on top of 'next', but I didn't want to do that".
And yes, you are right, because of this you need --onto in the rebase command.
Show 15 quoted lines
> Come on! Please, please, explain me why it behaves DIFFERENTLY: > > esajine@ESAJINEWWW /c/git_repos/test2 (topic) > $ git rebase --onto master topic > First, rewinding head to replay your work on top of it... > fatal: Not a range. > Nothing to do. > <======== topic..HEAD is not a range, agreed > > > esajine@ESAJINEWWW /c/git_repos/test2 (topic) > $ git rebase -i --onto master topic > Successfully rebased and updated refs/heads/topic. <=== BUG – here it > printed me “noop” in file to edit, when I exited it should do nothing, > but it still did something and I double checked it.
A historical accident, so to say. The implementor of interactive rebase felt the "noop" behavior was useful, and I agree, FWIW.
-- Hannes