I am trying to restore an earlier state of my repository. I want to remove all commits made since a certain point. There are twelve commits I want to remove. I tried running git reset --hard HEAD~12
followed by git push
, and I got the following error:
! [rejected] gh-pages -> gh-pages (non-fast-forward)
error: failed to push some refs to 'the_repo'
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.
I read up about non-fast-forward and I think that I actually do want to do that (i.e. there is nothing in those twelve commits I want to save). How can I successfully undo those commits?