SourceTree: undo pushed commit

Viewed 42

I have accidentally pushed a large (complete project altering) commit to the wrong repo.

See screenshot.

Screenshot

I have locally reverted master to the "good" commit, but I would like to revert origin/master to the "good" commit and prevent the "accident" commit from being pulled by others on the project.

How is the easiest/cleanest way to accomplish this?

1 Answers

A git push -f origin master (in command-line) should be enough.

With SourceTree, after selecting "Enable Forse Push":

https://i.stack.imgur.com/lygMh.png

But:

prevent the "accident" commit from being pulled by others on the project

Others might already have pulled from your project: you will have to contact them, asking them to fetch and reset their own local master branch to the new origin/master.

Related