# Generating a todo file for non-interactive rebasing

4 messages from 2019-04-16 to 2019-04-17. Participants: Drew DeVault, Phillip Wood, Johannes Schindelin.
Thread: https://gitlist.dev/t/50941

## Drew DeVault, 2019-04-16 15:37

Subject: Generating a todo file for non-interactive rebasing
Message-ID: <20190416153709.GA19000@homura.localdomain>
URL: https://gitlist.dev/e/20190416153709.GA19000%40homura.localdomain

```
Hiya!

Whenever I do a particularly long rebase on a branch, sorting out
conflicts from upstream, I find that it's often useful to have the
additional context that you get during an interactive rebase, such as
recent commands run, commands planned to run, and so on, to get a better
idea of where I'm at during the rebase. These show when you run `git
status` during an interactive rebase.

However, the code that generates this report relies on a todo list being
generated in the rebase state directory. A todo list which consists only
of "pick" commands is functionally equivalent to a non-interactive
rebase, the only difference being that the editor isn't shown to the
user.

Is there any reason not to refactor the rebase command to always
generate a todo list? This would simplify the internals and provide more
context to the user during hairy rebases. It might also be useful to run
--edit-todo if you realize your rebase strategy needs to change partway
through a rebase which was initially non-interactive.

Note: I'm a non-subscriber, please Cc me on replies.

-- 
Drew DeVault

```

## Phillip Wood, 2019-04-17 14:59

Subject: Re: Generating a todo file for non-interactive rebasing
Message-ID: <07e0259b-0d7a-b109-cd3c-ccfbf17ad573@gmail.com>
URL: https://gitlist.dev/e/07e0259b-0d7a-b109-cd3c-ccfbf17ad573%40gmail.com
In-Reply-To: <20190416153709.GA19000@homura.localdomain>

```
Hi Drew

On 16/04/2019 16:37, Drew DeVault wrote:
> Hiya!
> 
> Whenever I do a particularly long rebase on a branch, sorting out
> conflicts from upstream, I find that it's often useful to have the
> additional context that you get during an interactive rebase, such as
> recent commands run, commands planned to run, and so on, to get a better
> idea of where I'm at during the rebase. These show when you run `git
> status` during an interactive rebase.
> 
> However, the code that generates this report relies on a todo list being
> generated in the rebase state directory. A todo list which consists only
> of "pick" commands is functionally equivalent to a non-interactive
> rebase, the only difference being that the editor isn't shown to the
> user.
> 
> Is there any reason not to refactor the rebase command to always
> generate a todo list? This would simplify the internals and provide more
> context to the user during hairy rebases. It might also be useful to run
> --edit-todo if you realize your rebase strategy needs to change partway
> through a rebase which was initially non-interactive.

Things are moving in that direction. Currently --merge, --keep-empty, 
--recreate-merges and --exec will result in a todo list being used 
regardless of --interactive. There was some discussion a couple of 
months ago about making --merge the default if there were no am specific 
options given but I've not noticed a patch for that yet. There is also a 
GSoC project that will implement some of the am specific options for the 
interactive backend with the long term aim of removing the am based backend.

Best Wishes

Phillip
> 
> Note: I'm a non-subscriber, please Cc me on replies.
> 

```

## Johannes Schindelin, 2019-04-17 16:11

Subject: Re: Generating a todo file for non-interactive rebasing
Message-ID: <nycvar.QRO.7.76.6.1904171754060.46@tvgsbejvaqbjf.bet>
URL: https://gitlist.dev/e/nycvar.QRO.7.76.6.1904171754060.46%40tvgsbejvaqbjf.bet
In-Reply-To: <20190416153709.GA19000@homura.localdomain>

```
Hi Drew,

On Tue, 16 Apr 2019, Drew DeVault wrote:

> Whenever I do a particularly long rebase on a branch, sorting out
> conflicts from upstream, I find that it's often useful to have the
> additional context that you get during an interactive rebase, such as
> recent commands run, commands planned to run, and so on, to get a better
> idea of where I'm at during the rebase. These show when you run `git
> status` during an interactive rebase.
>
> However, the code that generates this report relies on a todo list being
> generated in the rebase state directory. A todo list which consists only
> of "pick" commands is functionally equivalent to a non-interactive
> rebase, the only difference being that the editor isn't shown to the
> user.
>
> Is there any reason not to refactor the rebase command to always
> generate a todo list? This would simplify the internals and provide more
> context to the user during hairy rebases. It might also be useful to run
> --edit-todo if you realize your rebase strategy needs to change partway
> through a rebase which was initially non-interactive.

The default mode of the rebase command is actually not based on picks, but
internally generates mails, puts them into an mbox, and then pretends to
apply those patches from a mailing list.

That mode is obviously very different from the interactive rebase, so
there is not quite the simplification in store that you hoped for.

However, we recently changed the way the --merge backend works, and it is
now indeed backed by the same machinery as the interactive rebase.
Meaning: if you call `git rebase -m <options>...`, you have what you
wished for. This change is part of v2.21.0.

To my surprise, Elijah Newren (who authored that change) then demonstrated
that in most cases, the `--merge` backend is actually *faster* than the
default (`--am`) backend. There were patches floating around to make it
the default rebase backend for that reason, but those patches were not
picked up yet.

Short version: if you add `--merge` or `-m` to your `git rebase`
invocations, you already get what you want.

Ciao,
Johannes

```

## Drew DeVault, 2019-04-17 17:11

Subject: Re: Generating a todo file for non-interactive rebasing
Message-ID: <20190417171118.GC1178@homura.localdomain>
URL: https://gitlist.dev/e/20190417171118.GC1178%40homura.localdomain
In-Reply-To: <nycvar.QRO.7.76.6.1904171754060.46@tvgsbejvaqbjf.bet>

```
Thanks for clarifying this, folks.

On 2019-04-17  6:11 PM, Johannes Schindelin wrote:
> To my surprise, Elijah Newren (who authored that change) then demonstrated
> that in most cases, the `--merge` backend is actually *faster* than the
> default (`--am`) backend. There were patches floating around to make it
> the default rebase backend for that reason, but those patches were not
> picked up yet.

Would be cool to see these picked up.

```
