Today I did a git push --force, then I had to create a branch out of the old code, but other times I had to save the files I worked on, delete the local repository, git clone again, then reapply my fixes. I want to at least have a bookmark on how to fix things in the future.
Yes, I’ve heard about VSCode plugins, that supposed to help. But no, I don’t want to use a glorified webpage to do coding, regardless if it’s directly tied to Micro$lop, or some of the slop was removed by 3rd parties. I tried KATE once, I cannot go back to some sluggish webpage, which only argument for use at the moment is “but it has plugins”.


Since no one is answering directly, here’s the steps to follow and you can go from here to find the specific commands. If you want to get back to a specific point in the history of the remote repo as a means to undo a mistake, and then continue from that point with any changes then usually you want to do this in a non-destructive way. ie. accept you screwed up and don’t cover it up.
There are many ways but this is the way that works.