I accidentally pushed local:deploy
branch commits to remote:master
branch.
I know the last commit on remote master branch because I also have a local Master intact on this specific commit. Hence, I want to revert this incidence and set remote master to that specific commit. one way is to pull changes from remote master to local master and then remove commits of local:deploy
. I am afraid to make thing worse again. Please advise.
I use git for minimal operations ( git clone, add, push, pull) and does not have advance knowledge of rebase, cherry-pick etc.
Please advise on how to revert this incident.
If you want the remote to have the same commits as the local copy on the master
branch, and you are absolutely sure about this , then you can forcefully push your local master
to replace the remote's copy.
So, if your remote is named origin
, the commands to do this would be:
git checkout master
git push --force origin master
This cannot be undone, so make absolutely sure this is what you want to do. If you have any doubts at all, clone the remote to another directory before doing this, just in case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.