git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Eugene Sajine <euguess@gmail.com>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [BUG] - git rebase -i performs rebase when it shouldn't?
Date: Mon, 12 Apr 2010 17:13:32 +0200	[thread overview]
Message-ID: <4BC3389C.4090807@viscovery.net> (raw)
In-Reply-To: <q2z76c5b8581004120709t860ff112i5dd057327b94ad0e@mail.gmail.com>

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

The fact that the second commit from the tip of topic is also labeled
"next" is absolutely irrelevant to rebase. rebase only looks at the refs
that you tell it about: master and topic (implicitly pointed to by HEAD),
nothing else.

What you really want to do, obviously, is:

   git rebase --onto master next topic

No, there is no shorter form to spell this operation.

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

Not a bug.

Your command is the same as

   git rebase -i --onto master topic topic

because you are already on branch topic. Since there are no commits in the
range topic..topic, rebase -i told you "noop". This word is perhaps poorly
chosen, because it does not mean "no operation"[*], but "there are no
commits to transfer". But branch 'topic' that you gave as the last
argument (or implicitly by being at branch 'topic') is still transferred
--onto master. This explains the result that you observed.

Of course, if you do not 'reset --hard topic@{1}' at this point, you will
ultimately lose the commits on branch topic.

[*] You can get "no operation" by deleting the line "noop".

-- Hannes

  reply	other threads:[~2010-04-12 15:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-09 19:35 [BUG] - git rebase -i performs rebase when it shouldn't? Eugene Sajine
2010-04-10  4:26 ` Jeff King
2010-04-10  4:39   ` Junio C Hamano
2010-04-10  4:47     ` Jeff King
2010-04-10 19:58     ` Johannes Sixt
2010-04-11 10:15       ` Jeff King
2010-04-11 17:54         ` Johannes Sixt
2010-04-12  1:01           ` Jeff King
2010-04-12 10:50       ` Michal Vitecek
2010-04-12 17:39         ` Johannes Sixt
2010-04-10 22:10   ` Eugene Sajine
2010-04-11 10:22     ` Jeff King
2010-04-11 14:06       ` Eugene Sajine
2010-04-12 14:09         ` Eugene Sajine
2010-04-12 15:13           ` Johannes Sixt [this message]
2010-04-12 15:28             ` Eugene Sajine
2010-04-12 15:47               ` Johannes Sixt
2010-04-13 16:30                 ` Eugene Sajine
2010-04-14  6:08                   ` Johannes Sixt

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=4BC3389C.4090807@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=euguess@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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;
as well as URLs for NNTP newsgroup(s).