Re: [BUG] - git rebase -i performs rebase when it shouldn't?
- From
- Eugene Sajine <euguess@gmail.com>
- Date
- Apr 11, 2010, 14:06 UTC
- Message-ID
- <y2s76c5b8581004110706p7b63900aqf90f9c1462a1f637@mail.gmail.com>
- In-Reply-To
- <20100411102255.GB20484@coredump.intra.peff.net>
I got your point about the HEAD which is by default get's added to the end of the command, so it becomes
git rebase --onto master topic HEAD
I will think about it it more.
I'm pretty sure that i was surprised by the fact that i've got different behavior in interactive and non-interactive variants, but i will recheck.
I forgot to mention it was in windows version of git. I will try to provide the printout of my actions tomorrow when i will get to this machine.
Thanks a lot, Eugene
On Sun, Apr 11, 2010 at 6:22 AM, Jeff King <peff@peff.net> wrote:
Show 62 quoted lines
> On Sat, Apr 10, 2010 at 06:10:53PM -0400, Eugene Sajine wrote: > >> Actually no, i was not thinking about what you think i was;). What i >> was trying to understand with this command (git rebase --onto master >> topic) is the behavior of the system when the topic branch is indirect >> descendant of the master and the direct parent of topic (next) is >> omitted, skipped. > > But in "git rebase --onto master topic", the relationship between master > and topic is irrelevant. It is the same as: > > git rebase --onto master topic HEAD > > which will consider the range between topic and HEAD as the set of > commits to rebase. > > Did you want to do: > > git rebase --onto master next topic > > ? That would take the commits between next and topic (i.e., just "topic" > in your example), and rebuild them on top of master. > >> Now the problem i have is that: >> >> git rebase -i --onto master topic >> >> actually worked and did something, what i would not expect it to do. >> >> So, the problem is: non-interactive rebase DOES NOT execute the >> command, interactive DOES execute. > > That's not the result I get. The non-interactive rebase _does_ do the > same thing. Try this: > > mkdir repo > cd repo > git init > > echo content >>file && git add file && git commit -m one > git checkout -b next > echo content >>file && git add file && git commit -m two > git checkout -b topic > echo content >>file && git add file && git commit -m three > > git rebase --onto master topic > > You will see that "topic" has been reset back to commit one, the same as > master. > > If that was not happening before, it was likely because you were not > actually on the "topic" branch before. So who knows what the implicit > "HEAD" argument referred to. > >> The bug is in the fact that rebase works differently in interactive >> and non-interactive variants. > > I don't think it does, as shown by my example above. If you still think > so, please create a short test case that demonstrates the difference. > > -Peff >