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

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

From
GSGeorge Spelvin <lkml@sdf.org>
Date
Apr 7, 2020, 19:03 UTC
Message-ID
<20200407190339.GA20902@SDF.ORG>
In-Reply-To
<CA+KXf2A7L1fRC3+rmDaME186CYf4yS+-dBgy_FkEFVh887N7MA@mail.gmail.com>
On Tue, Apr 07, 2020 at 05:16:50AM -0400, Sebastien Bruckert wrote:
> Hmmm so you need some way to move C before your actual commit. To make
> it like a pseudo command, some kind of "git rebase --reattach C
> --after A"? This seems closer to your original idea.

That seems too special-purpose and hard to remember. The standard rebase -i operation (generate a todo list and drop me into an editor) is perfectly adequate and more familiar. This is a very manual operation, after all. ("-i" for "interactive" means "manual".)

Show 23 quoted lines
> Or why not modify "--edit-todo" to get commits from before your actual
> point? It could works like this:
> 
> Before:
> ```
> #pick b2a96fe O
> #pick acb7459 A
> #pick 0dac4a4 B
> edit 1f54e51 C
> edit cda2a7e D
> ```
> 
> After:
> ```
> #pick b2a96fe O
> edit 1f54e51 C
> pick acb7459 A
> pick 0dac4a4 B
> edit cda2a7e D
> ```
> 
> So that you are still at C, but keeping the changes you made before on
> A and B, and going through them only if you have conflicts.

Because the only reason this is interesting assumes that A and B have changed! If I didn't intend to modify A somehow, I wouldn't have included it in the rebase range. They're now edited patches A' and B'. So the state I want to get to is:

#pick b2a96fe O #pick acb7459 A #pick 0dac4a4 B reset b2a96fe O edit 1f54e51 C pick 7f0bcab A' pick fcd3c62 B' edit cda2a7e D

where it will pick the versions of A and B that include the edits I've already made.

Now, having the original commits mentioned in comments is useful, in case I made a mess of the edit and want to revert it. E.g. I can certainly see realizing, three commits later in the rebase, that I recolved a conflict wrong and should re-do it. Although this can probably be handled with a fixup.

Previous: Sebastien BruckertNext: Philip Oakley
Message 21 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.