Home > Mobile >  Reverting third party merge in GitHub
Reverting third party merge in GitHub

Time:07-15

Git gave me this reply:

$ git push -u origin master
To https://github.com/xxxxxxx/yyyyyy.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/xxxxxxx/yyyyyy.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

I don't want to integrate any remote changes to my local repository. I have already made many changes in my local repository. On a GitHub environment I see last commit is:

zzzzzzz Merge remote-tracking branch '1/master'

That means, user zzzzzzz (not me) made a merge to my remote repo in GitHub. And currently I am out of ideas, how to revert that commit in GitHub. In GitHub I can see only commit hash of that merge, but not any 'revert' button at that. Can I fix it remotely or I have to SSH into GitHub ? Any ideas ?! Thank you in advance !

CodePudding user response:

If you do not want that commit at all, you can simply force push your own branch (and make sure to have a word with the other contributor)

git push --force

You can also consider master as a protected branch and add a branch protection rule on it.

That way, no more surprise.

Finally, manage your collaborators list (you can remove a collaborator).

  • Related