Search code examples
gitrebase

Is it possible to select the first commit made in the repository in an interactive rebase?


I'm still learning git so don't have a clear idea.

I created a new repository and made 3 commits.

enter image description here

I want to rebase all the commits starting from the first one.

I do the command

git rebase -i 4a5244b

This is what's shown

enter image description here

The first commit 4a5244b is not there. Is this just a special edge case with rebase where you can edit the first commit or am I doing something wrong?


Solution

  • Yes, it's a special edge case because rebase asks you for a base commit and there is no ancestor of the root commit that you could give it. Fortunately, there is an option for this special case:

    git rebase -i --root