For background, I was using Github's automatic "Fetch upsteam" feature. I always do a compare first in the origial PR to merge from parent to fork, to make sure it's pulling from the parent master and going into my forked master. I've done this quite a few times now. There was one tiny merge conflict when reviewing the PR that I was already expecting and fixed on Github by clicking on fix conflicts. It then gave me an option after resolving the conflict, to either open up another PR officially, or merge to master. Usually I open up a PR, to just give a once over on all the changes one more time. The commit being pulled in however was small, only three lines had changed, so I assumed no need to review it again in a PR let's just get it merged. But after clicking merge to master, it merged to master in the parent repo. Taking all my commits in the forked repo and putting it's entire history in the parent's master.
Now the entire parent's repo commit history is borked. It's been overhauled by my forked repo's history.
My fork is for an entire different environment that we are slowly migrating too. So it has multiple commits that the parent doesn't have. But has all of the commits that the parent contains.
I don't know how to rollback the merge/all commits from the parent repo, as it seems to have steam rolled over the commit history. It's not just one commit that got merged to the master parent, but all of them mixed together.
What I want to have happen is to revert back to the old commit history.
I currently have a branch called backup_master that has the "correct" commit history that I want for the parent's master, but when trying to open a PR, it says there's nothing to compare with and all changes are up to date. Which I guess makes sense because the fork had all the commits on the parent's master mixed in with it's own.
I've tried things like hard resetting, and reverting which will get me back to the history I'd expect but won't let me merge to master.
Is there something I'm missing to fix this stupid mistake I made? I don't have permissions to just hard reset master itself.
I guess I wanted to check if my only option is to do the following assuming I can get permissions for it:
git checkout master
git reset --hard <commit HEAD of good history>
git push -f
Or if there's a more formal review process just to check things over (so that I don't make the same stupid mistake).
For more context this is what happened from an over simplified visual perspective:
Before dump mistake:
Fork master: A -> B -> C -> D -> E -> F -> G -> H -> I
Parent Master: A -> D -> F -> G -> H
After dump mistake:
Fork master: A -> B -> C -> D -> E -> F -> G -> H -> I
Parent Master: A -> B -> C -> D -> E -> F -> G -> H -> I
Thank you in advance for any suggestions/advice.