Hi there, apologies if I've posted this in the wrong section but I was sort of unsure where a question like this would go.
I've just made and pushed a commit using Git that I didn't mean to push to the master branch. The push was meant to go to a test branch to be reviewed but instead is now on the live master branch.
I need to undo this and get it off the master asap, and I'm having a lot of trouble doing this.
I've tried git revert <hashcode>, git push origin <hashcode>, and git reset <hashcode> hard but none of them remove the changes from the master branch!
I've tried git revert <hashcode>, git push origin <hashcode>, and git reset <hashcode> hard but none of them remove the changes from the master branch!
What should I do?
First do a git revert, then do a git push to push the commit that reverts the mistaken commit.
I believe that you could also do a reset to the previous commit and then do a forced push, but that is generally not a good idea if other people may also pull from that master branch.
First do a git revert, then do a git push to push the commit that reverts the mistaken commit.
I believe that you could also do a reset to the previous commit and then do a forced push, but that is generally not a good idea if other people may also pull from that master branch.
Thanks very much! I think the problem is solved, I really appreciate it.
Bookmarks