A developer in my team committed his changes to the wrong remote repository. I want to remove what he pushed to this repository on the remote repository. I don’t want to change anything locally.
Therefore how can I:
-
List the commits on the remote repository branch so that I can see which commits that have been pushed need to be removed.
-
Remove each of these commits on the remote repository branch so that I can go back to the commit before he pushed his changes.
I am not sure if “removing” is the correct process or if it is meant to be “revert” but in the end I need the remote repository branch to be back to where it was before he pushed his changes.
Mark where that branch was last by
inspect what you get from the server:
or
if your tag still makes sense that that’s where the remote branch should be, force push that up:
if it’s another commit, push that commit as the master:
clean up:
update your tracking branches since the fix:
This assumes “master” is the branch in question. Replace “master” with the proper branch name if it’s another one.