Eric Sunshine <sunsh...@sunshineco.com> writes: > On Mon, Aug 6, 2018 at 9:20 PM Hilco Wijbenga <hilco.wijbe...@gmail.com> > wrote: >> But your suggestion did make me think about what behaviour I would >> like to see, exactly. I like that Git removes commits that no longer >> serve any purpose (because I've included their changes in earlier >> commits). So I would not want to keep commits that become empty during >> the rebase. What I would like to see is that commits that _start out_ >> as empty, are retained. Would such behaviour make sense? Or would that >> be considered surprising behaviour? > > I, personally, have no opinion since I don't use empty commits. > Perhaps someone more experienced and more long-sighted will chime in.
0661e49a ("git-rebase.txt: document behavioral differences between modes", 2018-06-27) added the following. In short, "rebase -i" should already behave that way. + * empty commits: + + am-based rebase will drop any "empty" commits, whether the + commit started empty (had no changes relative to its parent to + start with) or ended empty (all changes were already applied + upstream in other commits). + + merge-based rebase does the same. + + interactive-based rebase will by default drop commits that + started empty and halt if it hits a commit that ended up empty. + The `--keep-empty` option exists for interactive rebases to allow + it to keep commits that started empty.