Suppose you create a new codebase and you have only 2 commits. Now you want to combine the 2nd commit to the 1st commit with this command.
git rebase -i HEAD~1
However, Git cannot perform that and it returns an error message like this.
error: cannot 'squash' without a previous commit
For this case, you should try this.
git rebase -i --root
Top comments (0)