0

I made a commit and push that includes a merge. It results in many errors so I want to roll back all the changes. I want to delete last pushed commit and return the origin to the highlighted commit. Here is the image that describes the problem.

Commit and merge

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
  • 3
    Possible duplicate of [How to revert Git repository to a previous commit?](https://stackoverflow.com/questions/4114095/how-to-revert-git-repository-to-a-previous-commit) – phd Apr 29 '18 at 15:04
  • @phd I think he wants to know how to solve it using sourcetree rather than the command line. – SomeGuyOnAComputer Apr 29 '18 at 18:50

1 Answers1

1

Assuming you have push rights:

git reset --hard HEAD~
git push -f origin master
Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
  • 1
    This will work but if you are working on a repository where other developers are also working, it is considered a very bad idea, as it can screw up other people's history in their copies of the repository. – Dan Lowe Apr 29 '18 at 14:28
  • yes doing this on a shared repo is a bad idea. In that case, pushing a revert commit is better. – Vamsidhar Reddy Gaddam Apr 29 '18 at 14:32