Reset or Revert to Previous Commit
Temporary Move Back
Temporary go back
git checkout <hash-or-ref>
Go back and create a new branch
git checkout -b <branch-name> <hash-or-ref>
Permanently Move Back
Hard reset and delete everything
git reset --hard <hash-or-ref>
Soft reset to keep working directory and staging index
git reset --soft <hash-or-ref>
Revert Commits
Revert last 2 commits by creating new commits
git revert HEAD~2
or
git revert HEAD~2..HEAD
Revert without creating comits
git revert --no-commit <hash>..HEAD