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

Re: [PATCH] rebase -i: introduce the 'test' command

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Dec 4, 2018, 09:13 UTC
Message-ID
<nycvar.QRO.7.76.6.1812041007070.41@tvgsbejvaqbjf.bet>
In-Reply-To
<20181203213134.GD8700@sigill.intra.peff.net>
Hi Peff,
On Mon, 3 Dec 2018, Jeff King wrote:
Show 31 quoted lines
> On Mon, Dec 03, 2018 at 08:01:44PM +0100, Johannes Schindelin wrote:
> 
> > > In this sort of situation, I often whish to be able to do nested rebases.
> > > Even more because it happen relatively often that I forget that I'm
> > > working in a rebase and not on the head, and then it's quite natural
> > > to me to type things like 'git rebase -i @^^^' while already rebasing.
> > > But I suppose this has already been discussed.
> > 
> > Varieties of this have been discussed, but no, not nested rebases.
> > 
> > The closest we thought about was re-scheduling the latest <n> commits,
> > which is now harder because of the `--rebase-merges` mode.
> > 
> > But I think it would be doable. Your idea of a "nested" rebase actually
> > opens that door quite nicely. It would not *really* be a nested rebase,
> > and it would still only be possible in interactive mode, but I could
> > totally see
> > 
> > 	git rebase --nested -i HEAD~3
> > 
> > to generate and prepend the following lines to the `git-rebase-todo` file:
> > 
> > 	reset abcdef01 # This is HEAD~3
> > 	pick abcdef02 # This is HEAD~2
> > 	pick abcdef03 # This is HEAD~
> > 	pick abcdef04 # This is HEAD
> > 
> > (assuming that the latest 3 commits were non-merge commits; It would look
> > quite a bit more complicated in other situations.)
> 
> Yeah, I would probably use that if it existed.
I kind of use it, even if it does not exist ;-)
> It would be nicer to have real nested sequencer operations, I think, for
> other situations.

I agree. But for the moment, our data format is too married to the exact layout of .git/, thanks to `git rebase`'s evolution from a Unix shell script.

Alban has this really great patch series to work on the todo list in-memory, and that paves the way to decouple the entire sequencer thing from the file system.

The most notably thing that still would need to be encapsulated would be the options: currently, there is a plethora of inconsistent options files being saved into the state directory (for some, the mere presence indicates `true`, some contain `true` or `false`, others contain text, etc).

> E.g., cherry-picking a sequence of commits while you're in the middle of
> a rebase.

You will be delighted to learn that you can cherry-pick a sequence of commits in the middle of a rebase already. I do `exec git cherry-pick <range>` *all* the time.

Show 5 quoted lines
> But I suspect getting that right would be _loads_ more work, and
> probably would involve some funky UI corner cases to handle the stack of
> operations (so truly aborting a rebase may mean an arbitrary number of
> "rebase --abort" calls to pop the stack). Your suggestion is probably a
> reasonable trick in the meantime.
You know what is an even more reasonable trick? Worktrees.

I only thought about that this morning, but I should have mentioned it right away, as I use it quite frequently.

When I have tricky nested rebases to perform, I do use throw-away worktrees where I check out unnamed branches, work on those, and then integrate them back into the "outer rebase" via the `reset` command in the todo list.

Ciao, Dscho

Previous: Jeff KingNext: Duy Nguyen
Message 18 of 21 in “rebase -i: introduce the 'test' command”
  1. rebase -i: introduce the 'test' commandPaul Morelle, Nov 28, 2018
  2. Johannes SchindelinNov 28, 2018
  3. Paul MorelleNov 28, 2018
  4. Johannes SchindelinNov 29, 2018
  5. Johannes SchindelinNov 29, 2018
  6. Jeff KingDec 1, 2018
  7. Eric SunshineDec 2, 2018
  8. Jeff KingDec 2, 2018
  9. Ævar Arnfjörð BjarmasonDec 11, 2018
  10. Jeff KingDec 11, 2018
  11. Johannes SchindelinDec 2, 2018
  12. Phillip WoodDec 3, 2018
  13. Jeff KingDec 3, 2018
  14. Luc Van OostenryckDec 3, 2018
  15. Johannes SchindelinDec 3, 2018
  16. Luc Van OostenryckDec 3, 2018
  17. Jeff KingDec 3, 2018
  18. Johannes SchindelinDec 4, 2018
  19. Duy NguyenDec 3, 2018
  20. Johannes SchindelinDec 3, 2018
  21. Jeff KingDec 3, 2018

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.