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

How to rebase after upstream was merged?

From
Johannes Sixt <j.sixt@eudaptics.com>
Date
Jul 4, 2007, 12:24 UTC
Message-ID
<468B918E.FBCADCB9@eudaptics.com>
I have this history:
o--o--o--o--o   <- origin
    \        \
     x--x--x--M--x--x  <- master (HEAD)

At this point I would like to rebase to straighten the history, but it won't let me:

    $ git rebase origin
    Current branch master is up to date.

However, if there were additional commits on origin, it would work as expected, i.e. all the 'x', but not 'M', would be moved on top of origin. The reason is that rebase checks whether the merge base of origin and HEAD is origin, and exits early if it is.

I would like to extend the check to also check for linear history. How can I do this most efficiently? My first try is along these lines:

  test $(git rev-list origin..HEAD | wc -l) = \
       $(git rev-list --no-merges origin..HEAD | wc -l)
Is there a better approach?
-- Hannes
Next: Johannes Schindelin
Message 1 of 3 in “How to rebase after upstream was merged?”
  1. Johannes SixtJul 4, 2007
  2. Johannes SchindelinJul 4, 2007
  3. Johannes SixtJul 4, 2007

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.