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

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

From
SBSebastien Bruckert <sbruckert.dev@gmail.com>
Date
Apr 7, 2020, 09:16 UTC
Message-ID
<CA+KXf2A7L1fRC3+rmDaME186CYf4yS+-dBgy_FkEFVh887N7MA@mail.gmail.com>
In-Reply-To
<20200406152450.GA9609@SDF.ORG>
Thank you for the more detailed explanation.
> I'm very interested in your opinion, but please note that we already have
> fixup commits for amending single commits in place.

Yes sorry, I still don't know everything about git and the way it works. But I'm working on it!

Show 9 quoted lines
> The problem that currently has no good solution arises when I realize
> halfway through a cleanup pass that things would be a lot simpler if I
> moved A to after C. "Hey, rather than adding A and then updating it to
> take C into account, how about I just do commit C first, and then add the
> final code of A in one step?"  That is, I want to change from O-A-B-C-D to
> O-B-C-A-D, but I didn't think of it until the rebase had reached O-A-B-C-.
>
> I think of it as "quilt pop" operation, taking patches off the
> applied list and putting them back on the todo.

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.

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.

If I understand your problem correctly (I hope), the more I think about it, the more this modified "--edit-todo" makes sense too me. Moreover, no problem for aborting, no big conceptual change, no change in the way rebase works. Only --edit-todo is enhanced.

It coincides with what you were saying at the beginning:
Show 14 quoted lines
> On Fri, Mar 20, 2020 at 03:51:20PM -0700, Junio C Hamano wrote:
> > I thought that "git rebase -i" allows the todo file (i.e. list of
> > steps still to be performed) to be edited before continuing; would>
> your use case be supported by using that?
>
> Mostly, if I do it very carefully, which is why I thought it would
> be easy to add.
>
> I think I could manually add the commits to the start of the todo file,
> reset --hard to the old state, and rebase --continue.
>
> But cutting and pasting commit IDs from git log into the todo file,
> and putting fixup commits in the right place is annoyingly fiddly.
> That's exactly the sort of thing computers are good at.
Previous: George SpelvinNext: George Spelvin
Message 20 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.