git reset --hard HEAD~2 code example
Example 1: git reset head of master
git fetch origin
git reset --hard origin/master
Example 2: git soft reset head
git reset --soft HEAD^
//resets head by 1
git fetch origin
git reset --hard origin/master
git reset --soft HEAD^
//resets head by 1