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

Re: What happened to having to recover from upstream rebase?

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 13, 2015, 09:37 UTC
Message-ID
<b1686e402e9459e58acc7700a12f377d@www.dscho.org>
In-Reply-To
<555107F7.1040906@gmail.com>
Hi Phil,
On 2015-05-11 21:50, Phil Susi wrote:
> So it used to be that when upstream rebased, you'd get an error when
> you tried to pull again
Not necessarily. You would get this error *only* if there was a merge conflict between the revisions (one revision being your remote-tracking branch *before* the pull, the other revision being your remote-tracking branch *after* the fetch implied by the pull).
Show 5 quoted lines
> and have to fix things up with some git reset
> or rebase hackery.  Trying to demo this today I found that the pull
> *worked*, using an automatic recursive merge.
> 
> Am I crazy in thinking this used to error, and if not, when did it change?
You are not crazy, but I believe it might be a misunderstanding how the rebased upstream and the pull interact. When an upstream branch is rebased after you merge it, you have essentially two disagreeing versions of upstream.
My reading is that you mistook the error Git showed when trying to merge two disagreeing versions of upstream for an error produced by pull *directly* when it detects that upstream has been rebased. There is no such test in `git pull`, though. And when the upstream is rewritten in a way that does *not* cause merge conflicts [*1*], your workflow simply does not work.
The easy way out is to use `git pull --rebase` which figures out from the previously fetched revisions of the upstream branch what commits were dropped/rewritten and does not attempt to merge them. Note: Your local commits on top of upstream are also rebased which possibly leads to conflicts using this method.

Ciao, Johannes

Footnote *1*: It is very easy to rewrite a branch in such a way: just amend the commit message and you end up with two disagreeing histories, where the *working directories* corresponding to the disagreeing revisions are identical and therefore merged in the most trivial manner. 
Previous: Phil SusiNext: Matthieu Moy
Message 2 of 3 in “What happened to having to recover from upstream rebase?”
  1. Phil SusiMay 11, 2015
  2. Johannes SchindelinMay 13, 2015
  3. Matthieu MoyMay 13, 2015

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.