how to delete all commits in local code example Example 1: git revert last commit unpushed git reset --soft HEAD~1 Example 2: git clear commits git reset --hard origin