git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug in git rebase -i where <upstream> is "HEAD" in 1.5.4?

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 7, 2008, 23:32 UTC
Message-ID
<7vlk5wmjfn.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<D94A5309-3EB0-46FA-9114-D11376585DBB@apple.com>
Adam Roben <aroben@apple.com> writes:
Show 13 quoted lines
>    I've discovered a difference in behavior between `git rebase` and
> `git rebase -i`, and I believe the behavior exhibited by `git rebase -
> i` is incorrect and should be changed to match `git rebase`. The
> behavior difference occurs when running the command in the form:
>
> git rebase [-i] <upstream> <branch>
>
>    If <upstream> is "HEAD", `git rebase` seems to perform these
> (correct) steps:
>
> A=$(git rev-parse HEAD)
> git checkout <branch>
> git rebase $A

Yes, I remember writing that side carefully, taking exactly this issue into account.

>    However, `git rebase -i` seems to perform these (incorrect) steps:

Yeah, I see that interactive side is sloppier. In git-rebase--interactive.sh, if you move

        HEAD=$(git rev-parse --verify HEAD) || die "No HEAD?"
        UPSTREAM=$(git rev-parse --verify "$1") || die "Invalid base"

around l.481 up so that they come before if test ! -z "$2", you would be Ok, although I didn't test it.

Previous: Adam Roben
Message 2 of 2 in “Bug in git rebase -i where <upstream> is "HEAD" in 1.5.4?”
  1. Adam RobenFeb 7, 2008
  2. Junio C HamanoFeb 7, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.