What I would suggest you to do would be to git reset --hard {previous commit}
on your master branch and then cherry pick the commits you want into master. Then you can do git push --force
to change your HEAD.
When you do checkout to a previous commit you are creating a temp branch.
git checkout {previous commit}