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

Re: git rebase behaviour changed?

From
Martin Langhoff <martin.langhoff@gmail.com>
Date
Jan 17, 2006, 08:33 UTC
Message-ID
<46a038f90601170033y334d111fjed277fc787a2e523@mail.gmail.com>
In-Reply-To
<7v8xtfclyx.fsf@assigned-by-dhcp.cox.net>
On 1/17/06, Junio C Hamano <junkio@cox.net> wrote:
> Sorry I am always slow but I am a bit slower than I usually am
> tonight, and do not understand this part without an
> illustration:

My fault. I did have a few bits of paper here on my lap, but gmail's textbox sucks at ascii art...

Show 11 quoted lines
>
>         master    1---2---3---4---5---A
>                  /           /
>         origin  0---6---7---B
>
>
>                 A = master head
>                 B = origin head == merge base
>
>         rev-list B..A = 1 2 3 4 5
>         rev-list A..B = 6 7
Yep, exacly the example I was thinking about.
(...)
> Among the first list of commit, there is #4 which is a merge.
> So we reject.  Is that what you meant?

Exactly. We refuse to reset the head and begin the rebase operation, because it looks like operator error.

> By the way, the longer I think about this, the more I agree with
> the conclusion of the earlier thread: "if you rebase, do not
> merge; if you merge, do not rebase".  It is really about picking
> the right workflow.

Definitely. But errors and misunderstandings are frequent, and people who haven't thought the process through or aren't that familiar with the internals are very likely to try it.

Refusing to rebase, with a good error msg gives the user a chance to evaluate what to do with the commits. Right now, if I read the situation right, there's a good chance commits 1,2 and 3 will be "lost" once the rebase is complete.

GIT won't literally lose them, someone could run git-fsck and fish out the dangling heads from the repo, and after a bit of spelunking recover them, but it's suddenly a really tricky operation.

cheers,
martin
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 9 in “git rebase behaviour changed?”
  1. Mike McCormackJan 17, 2006
  2. Junio C HamanoJan 17, 2006
  3. Mike McCormackJan 17, 2006
  4. Junio C HamanoJan 17, 2006
  5. Martin LanghoffJan 17, 2006
  6. Junio C HamanoJan 17, 2006
  7. Martin LanghoffJan 17, 2006
  8. Junio C HamanoJan 17, 2006
  9. Junio C HamanoJan 17, 2006

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.