Our branching model says that on master
branch should be the current production state.
Accindently a develop version was merged from developed
into master
and pushed by one of our new colleages. So on master
there's not our production state any more. I want to revert this to apply a hotfix but I fail.
To know all commits I first pulled the current master
:
git checkout master
git pull
Then, like said in this thread, I try to reset my local master
using
git reset --hard <versiontag>
git push --force origin master
But the forced push is rejected because the are "future" commits.
Total 0 (delta 0), reused 0 (delta 0)
To [URL OF MY REPO]
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[URL OF MY 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.
Yeah I know that there are commits. And I want to remove them from master
because they don't belong there (yet, until develop
is meant to be merged into master
)
How can I successfully revert my master branch to a current tag and then push this to remote or asked in another way - how can I get rid of the wrong merged commits in my master
branch?