I did some work, committed this and pushed it to the origin. Now I realize I want to go back to the point before I did the work.
I would like to restore my local and my origin repository to this earlier commit to the origin and I don't need to keep any of the changes I just made either locally or on the origin.
I really want to be sure I don't make a mistake. How can I do this? Do I need to first restore my local repo and then do another push to the origin?
Here's the command I think I need to do:
git reset --hard HEAD~1
followed by a commit and push to the origin
But it's a bit risky for me so I would like to get some confirmation if I'm correct.