Git Interactive Rebase The First Commit
Everytime I want to do an interactive rebase I pass the number of commits back that I want using head~number
:
> git rebase -i head~3
Recently I created a repo that had only 2 commits and I got an error when I tried to do a rebase the same way:
> git rebase -i head~2
fatal: Needed a single revision
invalid upstream 'head~2'
To avoid that error, you can use a --root
option to rebase the first commit:
> git rebase -i --root
Tweet