git rebase --root

01 Mar 22

Often when I'm initializing a new repository, I want to do an interactive rebase and tidy up my initial commits.

I'm used to rebasing on to a specific commit hash:

git rebase -i <commit-sha>

But everytime I try to do this with the root commit, I run into an error.

fatal: invalid upstream <commit-sha>

Buried deep in the documentation though is a solution!

git rebase -i --root

Happy rebasing!