remove a commit in a branch code example Example 1: remove the commit from local git reset --soft HEAD~1 Example 2: git delete commit 4785cd1e041 git reset --hard <sha1-commit-id>