revert commit local code example
Example 1: undo local commit
$ git reset --soft HEAD~1
Example 2: revert git commit
git revert <the_commit_hash>
Example 3: revert commit git
git revert <commit hash>
Example 4: revert commit git
$ git revert HEAD
Example 5: how to revert a git revert
git revert <commitHashOfTheRevert> # locate the hash the revert was done
#this will invert the changes made in that commit
#and preserve the git history