On Thu, Apr 9, 2020 at 5:50 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > "Elijah Newren via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > > > From: Elijah Newren <newren@xxxxxxxxx> > > > > While many users who intentionally create empty commits do not want them > > thrown away by a rebase, there are third-party tools that generate empty > > commits that a user might not want. In the past, users have used rebase > > to get rid of such commits (a side-effect of the fact that the --apply > > backend is not currently capable of keeping them). While such users > > could fire up an interactive rebase and just remove the lines > > corresponding to empty commits, that might be difficult if the > > third-party tool generates many of them. Simplify this task for users > > by marking such lines with a suffix of " # empty" in the todo list. > > > > Suggested-by: Sami Boukortt <sami@xxxxxxxxxxxx> > > Signed-off-by: Elijah Newren <newren@xxxxxxxxx> > > --- > > rebase -i: mark commits that begin empty in todo editor > > > > If this isn't enough, we could talk about resurrecting --no-keep-empty > > (and making --keep-empty just exist to countermand an earlier > > --no-keep-empty), but perhaps this is good enough? > > This does look like an unsatisfying substitute for the real thing, > but perhaps looking for " # empty" and turning them a drop is simple > enough? Emacs types may do something like > > C-x h C-u M-| > sed -e '/ # empty$/s/^pick /drop /' > <RET> > > and vi folks have something similar that begins with a ':'. > > But it would not beat just being able to say "--no-keep-empty" (or > "--discard-empty"), would it? > > On the other hand, even if there were "--discard-empty" available, > there may still be two classes of empty ones (e.g. ones that were > created by third-party tools, the others that were deliberately > empty) that the user may need and want to sift through, and for such > a use case, the marking this patch does would be very valuable. > > So, from that point of view, this may not be enough, but a "throw > away all" option is not enough, either. We'd want to have both to > serve such users better. This was why I wondered whether it might be worth extending the --empty option to add another possible value, like "drop-all", that would allow the caller to say they want to drop all empty commits--both those that started out empty and those that became empty. That fourth mode would be distinct from the existing three. (I'm not sure what to call said mode; "drop-all" looks odd alongside the existing "drop". I just say "drop-all" here to help illustrate the idea.)