Git: How do I rewind the Master branch on the remote origin

Posted by user277260 on Stack Overflow See other posts from Stack Overflow or by user277260
Published on 2010-03-27T15:23:26Z Indexed on 2010/03/27 15:33 UTC
Read the original article Hit count: 152

Filed under:
|
|

I made 5 commits to Master branch when bug hunting on a private project and pushed them to the remote origin (my own private vps).

Then I saw that commits 4 and 5 were going to cause trouble elsewhere and I need to undo them, so I checked out commit 3 again, made a new branch "Dev" from that point, and did a few more commits fixing the issue properly.

Then I did

git reset --hard HEAD~2 on Master to pull it back to the point that I branched Dev.

Then I did git merge to fast forward Master back to the end of the Dev branch.

So now I have a local repository, with Dev and Master both pointing to the same, up to date version of the project with the latest bug fix.

Problem is, when I try to push the project now to the origin, it fails and gives me an error message:

! [rejected] master -> master (non-fast forward) error: failed to push some refs to 'myserver...myproject.git'

What have I done wrong, and how do I fix it?

Thanks

© Stack Overflow or respective owner

Related posts about git

Related posts about remote