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

Re: Feature request: rebase -i inside of rebase -i

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Mar 31, 2020, 13:36 UTC
Message-ID
<ef1a1475-45b3-8696-ed1e-b28f7b655ece@gmail.com>
In-Reply-To
<7fbe0ddc-74a3-b6b5-09b1-bff171382d0e@iee.email>
Hi Philip, George and Johannes

I really like the idea of being able to extend or rewind an existing rebase to reedit commits.

On 31/03/2020 11:57, Philip Oakley wrote:
Show 14 quoted lines
> Hi george,
> 
> On 31/03/2020 01:00, George Spelvin wrote:
>> Thinking about Philip Oakley's suggestion, it dawned on me that
>> we can *already* do a nested rebase manually, and having a less
>> manual alias for the procedure would be reasonable.
>>
>> Suppose the last four commits are O-A-B-C, and whether they were created
>> by this rebase or existed before is irrelevant.
>>
>> If I want to rebase --nested -i O, then I --edit-todo and
> 
> Maybe `--rework` as a possible alternate option name, if the concept of
> it being truly nested process does not work out?
or `--rewind` ?
Show 14 quoted lines
>> prepend the following four lines:
>> reset O
>> pick A
>> pick B
>> pick C
>>
>> If a nested rebase command does just that, I think it would cover my
>> use case.  If it adds a comment saying "nested rebase ends here",
>> it's easy to cancel the nested rebase if there was a mistake.
>>
>> A slightly fancier thing a nestrd rebase could do is see if any of the
>> newly created picks are also used in merges that were already in the todo
>> list.  In that case, follow the pick by a label command and update the
>> later merge to refer to the label.

If we're going to support rewinding a rebase that creates merges then this is a prerequisite otherwise it wont work properly. It will also need to update any existing labels that refer to a commits that get rewritten when rewinding.

When cancelling the nested rebase we need to take care to restore any labels to their previous value if they have been updated by the nested rebase. We also need to restore the list or rewritten commits so that we don't report that we've rewritten the commits from the nested rebase that we're aborting. These two requirements unfortunately make it difficult to implement the nested rebase just by updating the todo list. It needs to save the current labels (and reference the commits somewhere so they don't get gc'd) and the rewritten-list. `git rebase --abort` (or whatever we end up using to abort the nested part of the rebase) needs to restore the labels and rewritten-list. I think it should probably restore the todo list as well - if the original part of the todo list gets edited during the nested rebase should we drop those changes to the list or keep them when the nested rebase is aborted?

Best Wishes
Phillip
Previous: Philip OakleyNext: Philip Oakley
Message 12 of 25 in “Feature request: rebase -i inside of rebase -i”
  1. George SpelvinMar 20, 2020
  2. Junio C HamanoMar 20, 2020
  3. George SpelvinMar 20, 2020
  4. Johannes SchindelinMar 21, 2020
  5. George SpelvinMar 21, 2020
  6. Johannes SchindelinMar 25, 2020
  7. George SpelvinMar 26, 2020
  8. Johannes SchindelinMar 28, 2020
  9. George SpelvinMar 28, 2020
  10. George SpelvinMar 31, 2020
  11. Philip OakleyMar 31, 2020
  12. Phillip WoodMar 31, 2020
  13. Philip OakleyApr 1, 2020
  14. Phillip WoodApr 7, 2020
  15. Johannes SchindelinApr 4, 2020
  16. Johannes SchindelinApr 4, 2020
  17. George SpelvinApr 4, 2020
  18. Sebastien BruckertApr 6, 2020
  19. George SpelvinApr 6, 2020
  20. Sebastien BruckertApr 7, 2020
  21. George SpelvinApr 7, 2020
  22. Philip OakleyMar 30, 2020
  23. George SpelvinMar 30, 2020
  24. Philip OakleyMar 30, 2020
  25. Johannes SixtMar 21, 2020

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.