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

Re: [PATCH] pull --rebase: be cleverer with rebased upstream branches

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 26, 2008, 19:49 UTC
Message-ID
<alpine.LSU.1.00.0801261945210.23907@racer.site>
In-Reply-To
<7vk5lwz8ia.fsf@gitster.siamese.dyndns.org>
Hi,
On Sat, 26 Jan 2008, Junio C Hamano wrote:
Show 11 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > When the upstream branch is tracked, we can detect if that branch was 
> > rebased since it was last fetched.  Teach git to use that information 
> > to rebase from the old remote head onto the new remote head.
> 
> This is certainly nicer than the original (which is not in 1.5.3, so 
> even this late in the cycle it is "fixing up a new feature we will be 
> introducing in 1.5.4" category that I will apply).  But I think a bit of 
> caution and perhaps an illustration or two in the doucmentation would 
> help.
Well, I half expected it to be post-1.5.4.
> If you do "git fetch" from the origin since the last time you ran "pull 
> --rebase" for the remote, we will have the same issue.
Yes, that occurred to me, too.
Show 13 quoted lines
> So it might make sense to make the logic to figure out B, given
> your local history that leads from 0 to x's (and nothing else),
> a bit cleverer than looking at the tracking branch.  We can look
> at reflog for example.  "git log -g --pretty=oneline" may have
> entries of this form:
> 
>     * branch: Created from B
>     * rebase finished <branch> onto B
> 
> and the latest (i.e. younguest) entry is where the part of your current 
> history to be rebased (i.e. base commit) starts.  This is much more 
> reliable than looking at the tracking branch, whose answer may or may 
> not match B at all.

I did not want to do that, because it is quite possible that the reflogs were disabled, or that the relevant reflogs were already expired.

However, I think that it might be a good approach to try reflogs first, and fallback to what I sent if there are no reflogs (or if it is detected that the reflog entry is not possibly the correct one, since what was rebased to is no longer an ancestor of the current branch).

Ciao, Dscho

Previous: Junio C Hamano
Message 8 of 8 in “Should "pull --rebase" try to be a little cleverer?”
  1. Johannes SchindelinJan 21, 2008
  2. Nicolas PitreJan 21, 2008
  3. Johannes SchindelinJan 21, 2008
  4. Nicolas PitreJan 21, 2008
  5. Junio C HamanoJan 21, 2008
  6. pull --rebase: be cleverer with rebased upstream branchesJohannes Schindelin, Jan 26, 2008
  7. Junio C HamanoJan 26, 2008
  8. Johannes SchindelinJan 26, 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.