Not really. Interactive rebase is the only tool designed to do this kind of thing. You could, hypothetically, script this, though:
- Write a script that reads the list of
rebase -i
instructions from the file passed as its first argument - the file you'd normally get to edit yourself in an editor -, and writes a re-ordered list back into that file.
- Tell Git to use that script as an editor when starting the interactive rebase, so that it's used to rewrite the rebase instructions instead of letting you edit them manually.
The following should work, provided you have GNU sed installed (other editions of sed usually don't support the -i
flag):
GIT_SEQUENCE_EDITOR="sed -i -e '1 {h; d}; $ {p; g}'" git rebase -i <commit>~