revert to previous version git code example
Example 1: how to revert a commit
git reset --soft HEAD@{1}
git reset --hard HEAD@{1}
git push --force origin master
Example 2: how to return to latest version on git
// we need to type both of them git fetch origin git reset --hard origin/master
Example 3: how to revert back to previous commit in git
git reset --hard 0d1d7fc32
git stash
git reset --hard 0d1d7fc32
git stash pop
Example 4: after checking out a previous commit go back to latest commit
git checkout <commit hash>
git revert <commit hash>
Example 5: git revert all commits to pervious commit
git revert --no-commit <commithash>..HEAD
Example 6: git pull from previous commit
git checkout -b old-state 0d1d7fc32