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

Re: [PATCH v7 3/3] replay: offer an option to linearize the commit topology

From
Elijah Newren <newren@gmail.com>
Date
Jul 16, 2026, 03:53 UTC
Message-ID
<CABPp-BGdK8v8Qk5XB=QL_yJDPTNjSb2rN08GiPpK50V2gAj1QQ@mail.gmail.com>
In-Reply-To
<xmqqse5km6lc.fsf@gitster.g>
On Wed, Jul 15, 2026 at 11:49 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
>
> Elijah Newren <newren@gmail.com> writes:
>
> > Concretely: I have three branches to rebase onto master; one of them
> > happens to contain a merge I'd like flattened. I add  --linearize  for
> > that one merge — and now all three branches are silently concatenated
> > into a single chain.  That makes no sense to me, and I think won't to
> > most users.
>
> But if that is not the outcome they wanted, I fail to see why they
> would feed all three branches to a single invocation of --linearize
> in the first place.  After all, the command is only doing what it
> was asked to do.

Passing several branches isn't the user asking for concatenation; it's the user asking for replay's core feature: update many branches at once. Adding --linearize to flatten a merge does have to join the lines which that merge combined, but it shouldn't also weld together branches that were never merged in the first place. The user is combining two intended features, and the concatenation is an emergent third behavior that neither of them implies.

(Also, please note that I'm aware of the bug you raised earlier about dropped lines of history; my suggestion(s) don't reintroduce that bug.)

> If that breaks because by the time you feed branchC to the machinery
> nobody remembers that A1 and A2 were already handled, _that_ is the
> problem the command needs to solve, no?  I am confused.

Yes, precisely! That is the problem I want to be able to solve: updating multiple branches which may have shared history. The current proposed behavior feels hostile towards that. Concretely, I want to be able to update this history:

M1  M2  M3  M4  M5
*---*---*---*---* <- main
    |   \
    |    \  A1  A2  A4  A6  A7  A8
    |     \-*---*---*---*---*---* <- branchA
    \            \     /    \
     \            *---*      -*---* <- branchC
      \           A3  A5      C1  C2
       \
        \-*---* <- branchB
          B1  B2

via `git replay --linearize --onto main branchA branchB branchC` to (depending on where A4 is ordered relative to A3 & A5):

M1  M2  M3  M4  M5
*---*---*---*---* <- main
                |
                |   A1  A2  A4  A3  A5  A7  A8
                |---*---*---*---*---*---*---* <- branchA
                |                       \
                |                        -*---* <- branchC
                |                         C1  C2
                |
                \-*---* <- branchB
                  B1  B2

(note that both branchA and branchC become linear with the merge commit A6 being dropped)

In this graph:
  * branchA and branchC cannot easily be replayed with separate
commands (it requires tracking starting and stopping points and
figuring out shared history).
  * branchB could be done with a separate command from replaying the
other two, but _only if_ the user first verifies that it has no common
history with the other branches, and I think that's not useful
cognitive load to place on the user.

If concatenation really is the intended behavior for this patch series, then --linearize seems like the wrong name for it: the surprising part isn't that each branch becomes linear, it's that the option also chains together branches that were never related.

> Or do you want to be able to tell "linearlize B, A, and C in this
> turn on top of 'master'" and M1..M5..B1'..B3'..A1'..A4'..C1'..C2' as
> the result?

No, ordered-concatenation is not something I'm interested in. I want separate branches to stay separate, as in the second graph above. I almost wish I hadn't even mentioned ordering, even though I labelled it a "minor" point in my last email, because it seems to have distracted from the real issue.

As I proposed last time, I'd be fine with erroring on multiple positive refs as an interim step (plus associated documentation and commit message updates) so this series lands, with per-branch linearization as the real fix later.

Previous: Junio C HamanoNext: Junio C Hamano
Message 59 of 75 in “Teach git-replay(1) to linearize merge commits”
  1. 0/3 Teach git-replay(1) to linearize merge commitsToon Claes, Jun 8, 2026
  2. 1/3 replay: refactor enum replay_mode into a boolToon Claes, Jun 8, 2026
  3. 2/3 replay: add helper to put entry into mapped_commitsToon Claes, Jun 8, 2026
  4. 3/3 replay: offer an option to linearize the commit topologyToon Claes, Jun 8, 2026
  5. Junio C HamanoJun 8, 2026
  6. Toon ClaesJun 10, 2026
  7. 0/3 Teach git-replay(1) to linearize merge commitsToon Claes, Jun 10, 2026
  8. 1/3 replay: refactor enum replay_mode into a boolToon Claes, Jun 10, 2026
  9. Justin ToblerJun 11, 2026
  10. Toon ClaesJun 12, 2026
  11. 2/3 replay: add helper to put entry into mapped_commitsToon Claes, Jun 10, 2026
  12. 3/3 replay: offer an option to linearize the commit topologyToon Claes, Jun 10, 2026
  13. Junio C HamanoJun 10, 2026
  14. Toon ClaesJun 16, 2026
  15. Elijah NewrenJun 14, 2026
  16. Toon ClaesJun 16, 2026
  17. 0/3 Teach git-replay(1) to linearize merge commitsToon Claes, Jun 16, 2026
  18. 1/3 replay: refactor enum replay_mode into a boolToon Claes, Jun 16, 2026
  19. 2/3 replay: add helper to put entry into mapped_commitsToon Claes, Jun 16, 2026
  20. 3/3 replay: offer an option to linearize the commit topologyToon Claes, Jun 16, 2026
  21. 0/3 Teach git-replay(1) to linearize merge commitsToon Claes, Jun 22, 2026
  22. 1/3 replay: refactor enum replay_mode into a boolToon Claes, Jun 22, 2026
  23. Patrick SteinhardtJun 22, 2026
  24. Junio C HamanoJun 22, 2026
  25. Toon ClaesJun 24, 2026
  26. 2/3 replay: add helper to put entry into mapped_commitsToon Claes, Jun 22, 2026
  27. Patrick SteinhardtJun 22, 2026
  28. 3/3 replay: offer an option to linearize the commit topologyToon Claes, Jun 22, 2026
  29. Patrick SteinhardtJun 22, 2026
  30. Toon ClaesJun 26, 2026
  31. Patrick SteinhardtJun 29, 2026
  32. Johannes SchindelinJun 30, 2026
  33. Patrick SteinhardtJun 30, 2026
  34. 0/3 Teach git-replay(1) to linearize merge commitsToon Claes, Jun 26, 2026
  35. 1/3 replay: add helper to put entry into mapped_commitsToon Claes, Jun 26, 2026
  36. Junio C HamanoJun 26, 2026
  37. 2/3 replay: better explain how pick_regular_commit() picks a baseToon Claes, Jun 26, 2026
  38. 3/3 replay: offer an option to linearize the commit topologyToon Claes, Jun 26, 2026
  39. Junio C HamanoJun 26, 2026
  40. Phillip WoodJun 27, 2026
  41. Toon ClaesJul 1, 2026
  42. Johannes SchindelinJun 28, 2026
  43. Toon ClaesJun 30, 2026
  44. 0/3 Teach git-replay(1) to linearize merge commitsToon Claes, Jul 2, 2026
  45. 1/3 replay: add helper to put entry into replayed_commitsToon Claes, Jul 2, 2026
  46. 2/3 replay: resolve the replay base outside pick_regular_commit()Toon Claes, Jul 2, 2026
  47. 3/3 replay: offer an option to linearize the commit topologyToon Claes, Jul 2, 2026
  48. Junio C HamanoJul 3, 2026
  49. Toon ClaesJul 7, 2026
  50. Junio C HamanoJul 7, 2026
  51. 0/3 Teach git-replay(1) to linearize merge commitsToon Claes, Jul 7, 2026
  52. 1/3 replay: add helper to put entry into replayed_commitsToon Claes, Jul 7, 2026
  53. 2/3 replay: resolve the replay base outside pick_regular_commit()Toon Claes, Jul 7, 2026
  54. 3/3 replay: offer an option to linearize the commit topologyToon Claes, Jul 7, 2026
  55. Elijah NewrenJul 10, 2026
  56. Junio C HamanoJul 13, 2026
  57. Elijah NewrenJul 15, 2026
  58. Junio C HamanoJul 15, 2026
  59. Elijah NewrenJul 16, 2026
  60. Junio C HamanoJul 17, 2026
  61. Toon ClaesJul 27, 2026
  62. Junio C HamanoJul 8, 2026
  63. 0/3 Teach git-replay(1) to linearize merge commitsToon Claes, Jul 28, 2026
  64. 1/3 replay: add helper to put entry into replayed_commitsToon Claes, Jul 28, 2026
  65. 2/3 replay: resolve the replay base outside pick_regular_commit()Toon Claes, Jul 28, 2026
  66. 3/3 replay: offer an option to linearize the commit topologyToon Claes, Jul 28, 2026
  67. Justin ToblerAug 7, 2026
  68. Elijah NewrenAug 8, 2026
  69. Toon ClaesAug 31, 2026
  70. Junio C HamanoJul 28, 2026
  71. 0/3 Teach git-replay(1) to linearize merge commitsToon Claes, Aug 31, 2026
  72. 1/3 replay: add helper to put entry into replayed_commitsToon Claes, Aug 31, 2026
  73. 2/3 replay: resolve the replay base outside pick_regular_commit()Toon Claes, Aug 31, 2026
  74. 3/3 replay: offer an option to linearize the commit topologyToon Claes, Aug 31, 2026
  75. Elijah NewrenSep 1, 2026

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.