git go to old commit code example

Example 1: revert commit git

git revert <commit hash>

Example 2: git pull from previous commit

# This will detach your HEAD, that is, leave you with no branch checked out:
git checkout 0d1d7fc32

Example 3: git pull from previous commit

git checkout -b old-state 0d1d7fc32

Example 4: git revert to old commit

git reset --hard c14809fa

Example 5: get back some commits git

git revert {commit_id}'

Example 6: git move back one commit

# This will detach your HEAD, that is, leave you with no branch checked out:
git checkout 0d1d7fc32