Quick summary
To cancel a push in Sourcetree, you reset your current branch to an earlier commit in the History tab, then use a force push to overwrite the remote repository with the corrected state. This method effectively removes unwanted pushed commits from the remote repo without deleting local files.
Steps
- Go to the History tab in Sourcetree to view your commit log.
- Right-click the commit you want to revert to.
- Choose 'Reset current branch to this commit' from the context menu.
- In the 'Reset to Commit' window, select a reset mode (e.g. Mixed or Hard).
- Click 'OK' to confirm the branch reset.
- Click 'Push' to open the push dialog.
- Check the 'Force Push' option before pushing.
- Click 'Push' to complete the force push and remove the unwanted commits from the remote repo.



