how to delete unnecessary commits in git code example Example: git delete commit 4785cd1e041 git reset --hard <sha1-commit-id>