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

Re: git pull --rebase differs in behavior from git fetch + git rebase

From
Joshua Jensen <jjensen@workspacewhiz.com>
Date
Aug 28, 2010, 02:06 UTC
Message-ID
<4C786F36.3060107@workspacewhiz.com>
In-Reply-To
<AANLkTimBv3EVWaEnateD95sUi_LkmNw8RKJZYrW4dUFy@mail.gmail.com>
  ----- Original Message -----
From: Elijah Newren
Date: 8/27/2010 5:40 PM
Show 37 quoted lines
> On Fri, Aug 27, 2010 at 4:29 PM, Joshua Jensen
> <jjensen@workspacewhiz.com>  wrote:
>> It reports to me 'git-rebase --onto XXXX XXXX'.
>>
>> And it reports nothing to do.
>>
>> XXXX is properly the origin/master in this case.
>>
>> git rebase origin/master           works.
>> git rebase --onto origin/master origin/master       does not work.
>>
>> Thoughts?
> It's too bad you can't make this repository public; I thought rebase
> should behave the same for those two commands.  We could certainly
> just modify git-pull.sh to avoid using the --onto flag when
> oldremoteref is not defined (and perhaps that makes sense independent
> of anything else), but I'm curious now about rebase.
>
> Can you insert an echo statement right before where git-rebase calls
> format-patch to see what arguments it is passing in those two cases?
> For me it's around line 568; insert an echo statement so that it looks
> like:
>   if test -z "$do_merge"
>   then
>          echo git format-patch -k --stdout --full-index --ignore-if-in-upstream \
>                 --no-renames $root_flag "$revisions"
>          git format-patch -k --stdout --full-index --ignore-if-in-upstream \
>                  --no-renames $root_flag "$revisions" |
>          git am $git_am_opt --rebasing --resolvemsg="$RESOLVEMSG"&&
> Make that change, and then run it with both your rebase commands and
> see what you get.
>
> For me, in both cases, I get:
>    git format-patch ... --no-renames origin/master..HEAD
> (except sha1sums of what origin/master and HEAD were rather than that
> literal text), which means the same patches are being applied in both
> cases for me.

Okay, there is _not_ a problem with the patch in 1.7.2.2 for the "broken" repository I have in front of me right now, but I wish I hadn't trashed the other broken repository someone else had. :(

Before running a successful 'git rebase origin/master' on the broken repository, I made a copy of it. That person then committed and pushed the rebased commit. _I did not know that._

I copied the broken repository into two locations, testrebase and testpullrebase.

In the testrebase repository, I ran 'git rebase origin/master'. I did not fetch, so the repository was in the same state as the original broken copy.

In the testpullrebase repository, I ran 'git pull --rebase'. It fetched the latest commits (which included the person's pushed rebase commit), and I saw it supposedly didn't rebase the commit. However, it did the RIGHT thing, because the commit already exists in the repository.

Sorry for causing an issue, but I definitely appreciate the fix already being available.

Josh
Previous: Elijah NewrenNext: Elijah Newren
Message 8 of 10 in “git pull --rebase differs in behavior from git fetch + git rebase”
  1. Joshua JensenAug 27, 2010
  2. Santi BéjarAug 27, 2010
  3. Dave OlszewskiAug 27, 2010
  4. Joshua JensenAug 27, 2010
  5. Elijah NewrenAug 27, 2010
  6. Joshua JensenAug 27, 2010
  7. Elijah NewrenAug 27, 2010
  8. Joshua JensenAug 28, 2010
  9. Elijah NewrenAug 28, 2010
  10. Joshua JensenAug 28, 2010

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.