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.
Asked
Active
Viewed 38 times
0
-
3Possible 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 Answers
1
Assuming you have push rights:
git reset --hard HEAD~
git push -f origin master

Dan Lowe
- 51,713
- 20
- 123
- 112

Vamsidhar Reddy Gaddam
- 351
- 1
- 7
-
1This 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