revert revert git code example Example 1: revert commit git $ git revert HEAD Example 2: git revert commit git revert <commit hash>