git command to move to previous commit code example
Example 1: git move branch to previous commit
git checkout 1258f0d0aae #detach from master
git branch -f master HEAD #exactly as above
#optionally reattach to master
git checkout master
Example 2: git revert all commits to pervious commit
git revert --no-commit <commithash>..HEAD #revert changes in range of commits from head to back to that commit hash
Example 3: git pull from previous commit
git checkout -b old-state 0d1d7fc32