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

Re: Git rebase aggravation

From
Thomas Rast <trast@student.ethz.ch>
Date
Feb 23, 2009, 09:34 UTC
Message-ID
<200902231034.08736.trast@student.ethz.ch>
In-Reply-To
<22155203.post@talk.nabble.com>
Myxz Ptlk wrote:
> 1)  Rebase master into zoo.
> 
> 2) Merge zoo into master.

You may want to consider a merge and topic branch based workflow. man gitworkflows has some pointers.

For the rest of the discussion let's assume that your history looks like

  *---*---*---*  (master)
   \
    \
     o---o---o   (zoo = origin/zoo)

Since you have tracking branches, origin/zoo should be the same as zoo. (origin/master should exist too but isn't important for now.)

> But here is what happens.  I spend 3 hours inside "zoo" doing "git rebase
> master".  I go through all the hell of reconciling 6 months of development. 
> Then at the end, it just says that the commits now differ between local
> "zoo" and "origin/zoo".
Indeed, since you rewrote every commit on zoo, it now looks like
  *---*---*---*   (master)
  |            \                 
  |             \                
  \              o'--o'--o'   (zoo)
   \
    o---o---o  (origin/zoo)
> So I figure, I will pull from "origin/zoo".  Naturally, that results in a
> conflicted merge, which I then clear up.  I commit the merge, then push
> everything back to the remote branch.
You're merging like this:
  *---*---*---*   (master)
  |            \                 
  |             \                
  \              o'--o'--o'---M   (zoo)
   \                         /
    o---o---o---------------'
              (origin/zoo)
I think you can already see that you made a mess of history :-)

You should have forced the push instead. But see "recovering from upstream rebase" in man git-rebase for information on what happens to everyone else's work that was based on zoo.

Show 8 quoted lines
> My thinking is that if I were to attempt a new rebase of master, the
> beginning of what would be rebased would start from RIGHT NOW, instead of
> all the commits over the past 6 months.  To check this, I type:
> 
> git rebase master
> 
> from "zoo".  Lo and behold, it starts the whole process over again.  I "git
> rebase --abort", but I am very, very confused.

Actually it's even worse: it should attempt to rebase _every_ commit in master..zoo. If master has progressed since your original rebase+merge, this will be both the "o" and "o'" commits above.

(Except the ones that did not conflict at all, since they'll still be the same.)

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Nazri Ramliy
Message 3 of 3 in “Git rebase aggravation”
  1. Myxz PtlkFeb 23, 2009
  2. Nazri RamliyFeb 23, 2009
  3. Thomas RastFeb 23, 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.