revert commited changes in git code example Example 1: revert git commit git revert <the_commit_hash> Example 2: revert last commit git reset HEAD~