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

Re: tracking branch for a rebase

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Sep 5, 2009, 14:01 UTC
Message-ID
<20090905140127.GA29037@atjola.homenet>
In-Reply-To
<20090905061250.GA29863@coredump.intra.peff.net>
On 2009.09.05 02:12:50 -0400, Jeff King wrote:
Show 20 quoted lines
> On Fri, Sep 04, 2009 at 08:59:49PM +0200, Björn Steinbrink wrote:
> 
> > "git pull --rebase" is not the same as:
> > "git fetch origin && git rebase origin/foo", but:
> > 
> > git fetch origin && git rebase --onto origin/foo $reflog_merge_base
> > 
> > Where $reflog_merge_base is the first merge base is found between the
> > current branch head, and the reflog entries for origin/foo.
> 
> Thanks, I didn't know about the trick (not being, as I mentioned, a pull
> --rebase user). I can see arguments for or against a rebase-default
> using that feature. On one hand, it simplifies the explanation for
> people going between "pull --rebase" and "fetch && rebase". And I think
> it should generally Do What You Mean in the case that upstream hasn't
> rebased. Are there cases you know of where it will do the wrong thing?
> 
> I don't know if people would be confused that "git rebase" does not
> exactly default to "git rebase $upstream", which is at least easy to
> explain.

For me, the confusion would arise from the fact that "git rebase" (without args) would seem like a "pull --rebase" without the fetch, but isn't. And to reducing the difference to just the fetch would require a quite change in bahaviour.

Currently, when branch.<name>.merge is set: "git rebase <upstream>" ==> Can't really be done with "pull --rebase" "git pull --rebase [...]" ==> Can't be done with "rebase" alone.

Currently, "pull" is a convenience thing, and thus may do more magic, while "rebase" is dumb, and needs arguments. Starting to add _different_ magic to rebase seems wrong to me.

Show 6 quoted lines
> And by automating the shorthand we reduce the chance of errors. For
> example, I usually base my topic branches from origin/master. But the
> other day I happened to be building a new branch, jk/date, off of
> lt/approxidate, salvaged from origin/pu. I did "git rebase -i
> origin/master" and accidentally rewrote the early part of
> lt/approxidate.

Hm, I'd prefer a shorthand for "upstream for this branch", instead of magic defaults.

Show 6 quoted lines
> > Now, basically "git svn rebase" is pretty much git-svn's "pull". Maybe
> > its idea could be taken, so we get "git pull --local" to just skip the
> > fetch part, but keep "git rebase" and "git merge" 'dumb', requiring
> > explicit arguments.
> 
> That wouldn't help me, because you can't "pull -i". :)

I probably shouldn't tell anyone, as it's a crude hack, but "git pull --rebase -s -i" does the trick... *hides*

Björn
Previous: Jeff KingNext: Jeff King
Message 6 of 39 in “tracking branch for a rebase”
  1. Pete WyckoffSep 4, 2009
  2. Michael J GruberSep 4, 2009
  3. Jeff KingSep 4, 2009
  4. Björn SteinbrinkSep 4, 2009
  5. Jeff KingSep 5, 2009
  6. Björn SteinbrinkSep 5, 2009
  7. Jeff KingSep 5, 2009
  8. Junio C HamanoSep 7, 2009
  9. Michael J GruberSep 7, 2009
  10. Junio C HamanoSep 7, 2009
  11. Jeff KingSep 7, 2009
  12. Michael J GruberSep 7, 2009
  13. Jeff KingSep 7, 2009
  14. Johannes SchindelinSep 7, 2009
  15. Michael J GruberSep 7, 2009
  16. Julian PhillipsSep 8, 2009
  17. Jeff KingSep 9, 2009
  18. Junio C HamanoSep 10, 2009
  19. Johannes SchindelinSep 10, 2009
  20. Introduce <branch>@{tracked} as shortcut to the tracked branchJohannes Schindelin, Sep 10, 2009
  21. Michael J GruberSep 10, 2009
  22. Johannes SchindelinSep 10, 2009
  23. Johan HerlandSep 10, 2009
  24. Michael J GruberSep 10, 2009
  25. Johan HerlandSep 10, 2009
  26. Johannes SchindelinSep 10, 2009
  27. Michael J GruberSep 10, 2009
  28. Jeff KingSep 10, 2009
  29. Junio C HamanoSep 10, 2009
  30. Björn SteinbrinkOct 2, 2009
  31. Jeff KingSep 10, 2009
  32. Jeff KingSep 10, 2009
  33. Johannes SchindelinSep 10, 2009
  34. Introduce <branch>@{upstream} as shortcut to the tracked branchJohannes Schindelin, Sep 10, 2009
  35. Jeff KingSep 10, 2009
  36. Johannes SchindelinSep 10, 2009
  37. Johannes SchindelinSep 10, 2009
  38. Junio C HamanoSep 11, 2009
  39. Junio C HamanoSep 5, 2009

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.