Git allows certain commands to create or modify commits without opening the editor first, for example:
git commit --amend --no-edit
git commit --fixup=HEAD^
I have set rebase.autosquash
to true
, so that the todo list for an interactive rebase is automatically reordered. Is there a way to immediately perform the rebase, without opening the editor first, something like:
git rebase -i --no-edit HEAD~3
TL;DR answer:
GIT_SEQUENCE_EDITOR=: git rebase -i HEAD~3
You can't stop
git rebase --interactive
from running the "sequence editor" (that's the edit command on the "sequence file" containing the various pick, etc., commands). However, if you examine the interactive rebase script:you'll find code like this near line 230 or so:
Thus, you simply need to set the sequence editor to an "edit" command that does nothing and then succeeds, such as the shell's built-in
:
command, or thetrue
command.(Any of
$GIT_SEQUENCE_EDITOR
, the configuredsequence.editor
, or$GIT_EDITOR
will suffice for this, though the obvious best one to use is the first.)