I have done 4 wrong commits and want to go back to old state. Hence tried something like this (reference)
# Resets index to former commit; replace '56e05fced' with your commit code
git reset 56e05fced
# Moves pointer back to previous HEAD
git reset --soft HEAD@{1}
git commit -m "Revert to 56e05fced"
# Updates working copy to reflect the new commit
git reset --hard
and I got a message
HEAD is now at 56e05fced
after this I tried git push origin master
to make sure the above changes are moved to master branch. But it throws an error to me
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'xxxxxxxxxxxx.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
how can I fix the issue here. (I don't want to pull the old master again as suggested in the above message)