Git - cannot 'squash' or 'fixup' without a previous commit
author: Paul Kim
Sometimes, I want to squash my second commit with my first commit:
Normally, I would do something like this, but there is only one other commit in the upstream. So I get a fatal error:
So I interactively rebase up one commit upstream.
Now I need to edit the rebase todo file.
But I cannot squash the commit without a previous commit.
Otherwise, I get an error:
Also, I cannot fixup the commit without a previous commit.
Again, I get an error:
So, I abort this rebase.
And try again.
This time, we edit the commit (which doesn't require a previous commit):
This time, there is no error.
Before we amend the commit, we need to have the HEAD point to the first commit:
Now we can amend the commit. Optionally, without editing the commit message:
Continue with the rebase.
Force push the changes upstream.
And now, I'm able to merge my second commit into my first commit.