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
Dave Olszewski <cxreg@pobox.com>
Date
Aug 27, 2010, 08:27 UTC
Message-ID
<alpine.DEB.2.00.1008270124450.20874@narbuckle.genericorp.net>
In-Reply-To
<4C772A01.5030207@workspacewhiz.com>
On Thu, 26 Aug 2010, Joshua Jensen wrote:
Show 21 quoted lines
> I have a case where 'git pull --rebase' does not do the Right Thing 
> (according to me).
>
> If I run 'git rebase origin/master', that rebase does the right thing, 
> perfectly reapplying my *single* commit on top of the upstream.
>
> 'git pull --rebase' ends up reapplying a bunch of much earlier commits and 
> ends up with a conflict.
>
> The documentation for git pull --rebase states: "Instead of a merge, perform 
> a rebase after fetching. If there is a remote ref for the upstream branch, 
> and this branch was rebased since last fetched, the rebase uses that 
> information to avoid rebasing non-local changes."  I do not understand
>
> I'm studying the git-pull script right now, but I have to admit this is 
> beyond me.  I'm sure if I stare hard enough, I'll get it.
>
> I mistakenly have assumed 'git pull' = 'git fetch; git merge' and that 'git 
> pull --rebase' = 'git fetch; git rebase'.  Does anyone want to clarify what 
> is really going on?  Unfortunately, I can't publish the repository in 
> question.

Are you by any chance running a git with commit cf65426de? If not, give it a try and see if it corrects your issue.

The main difference between "git pull --rebase" and "git fetch && git rebase @{u}" is that "git pull --rebase" will attempt to use the reflog to find a suitable "upstream" candidate instead of assuming your tracking branch is the upstream itself. This is intended to help recover from upstream rebases, but has adverse effects sometimes, which commit cf65426de should help with.

     Dave
Previous: Santi BéjarNext: Joshua Jensen
Message 3 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.