Fix "cannot 'squash' without a previous commit" for Git
Franz Wong
Posted on May 22, 2020
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
💖 💪 🙅 🚩
Franz Wong
Posted on May 22, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
githubcopilot AI Innovations at Microsoft Ignite 2024 What You Need to Know (Part 2)
November 29, 2024
authorization How to Set Up Authorization in a Bookstore Management System with Go, HTMX, and Permit.io
November 29, 2024