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

Re: Difference between pull --rebase and fetch+rebase

From
SBSanti Béjar <santi@agolina.net>
Date
Jan 8, 2010, 11:05 UTC
Message-ID
<adf1fd3d1001080305k138a2670k17a126cc0b8430b8@mail.gmail.com>
In-Reply-To
<1262907485376-4269422.post@n2.nabble.com>

On Fri, Jan 8, 2010 at 12:38 AM, martinvz <martin.von.zweigbergk@gmail.com> wrote:

Show 53 quoted lines
>
>
> Santi Béjar-2 wrote:
>>
>> Can you provide, at least, a graph of your history (ala git log
>> --graph --oneline for example)? And plot also the reflog entries and
>> all the important commits.
>>
>
> $ git log --graph --format=%h --all
> * 2038a46 # topic-2
> * a7b93b2
> * f2501ae # origin/main
> * cd5aaa9
> * cb232f3
> ...
> * 5ed0d06
> * 3067862
> | * 6eba2fa # topic-1
> | * b09aaf4
> | * bc3b72a
> |/
> | * 03d0d84 # topic-3
> | * 5160773
> | * 3c25642
> |/
> | * 6e9b12b # topic-4
> | * 75f5ab2
> | * bdd08ce
> | * b5d5759
> |/
> * 486b580
> * a021696
> * 3ffe7df
> * d0f55c5
> ...
>
> I have topic-1 checked out and run "git pull" and expect it to rebase (only)
> commits bc3b72a, b09aaf4, 6eba2fa onto f2501ae, but it starts by applying
> a021696 and 486b580.
>
> $ git reflog -g origin/main
> f2501ae refs/remotes/origin/mai  n@{0}: fetch origin: fast forward
> 3ffe7df refs/remotes/origin/mai  n@{1}: fetch origin: fast forward
> ...
>
> I hope that's all that's all you need. It seems that the problem is that the
> oldremoteref gets overwritten with the entry from the reflog. Is the problem
> that 3ffe7df appears in the reflog or that 486b580 doesn't appear there? I'm
> not clear on what ends up in the reflog.
>
> I just realized that I myself created a021696 and 486b580 (but not 3ffe7df),
> probably by rebasing some now-dead branch against origin/main.

Yes, it is. The code expects that you always branch your topic branches from the upstream branch, so all the possible fork points are in the reflog. Your flow was to create the topic from a local commit and then push that commit.

By the way, when Git tries to apply these two commits it should detect that they are already applied so it should do nothing, isn't it?

HTH, Santi

Previous: martinvzNext: martinvz
Message 7 of 8 in “Difference between pull --rebase and fetch+rebase”
  1. martinvzJan 7, 2010
  2. martinvzJan 7, 2010
  3. Santi BéjarJan 7, 2010
  4. martinvzJan 7, 2010
  5. Santi BéjarJan 7, 2010
  6. martinvzJan 7, 2010
  7. Santi BéjarJan 8, 2010
  8. martinvzJan 8, 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.