How to handle if you accidently push to main
Anyone have a good video on how to handle this? I just had a "oh no" moment where I accidently pushed to main. I wanted to do it right and go the PR route so I attempted to revert the changes in main while keeping what I wanted on the local branch. The gist of what happened was my main ended up being what I wanted (old accepted PR) however my new branch was now trying to "pull" my reverts. To solve this I cheated and merged the PR branch into main and then pushed it. Since it's just my program I figured it's not the end of the world. Anyone more experienced know any good resources on how to address this? I was mortified I was going to accidently lose a lot of code I did today. My way worked for me. But hypothetically if I was working on a project with multiple people that could be different. I assume my issue was my local main/local branch was tracking something incorrectly. In the moment I have not been thinking clearly but I have been sweating for the last hour trying to make sure I didn't lose anything important.