Here is what happened:
I have two remote git branches: master
and feature1
. For some reason I have to use git push --force
for the feature1
branch, but I didn't know when I use git push --force
it will also push the master
branch. Then, a disaster happened, as I pushed my local master
branch to the remote repository.
Luckily, my local branch is not too far away from the remote. Basically, my remote master
has two pull requests merged ahead of my local master
.
So my problem is: can I reopen the pull request and remerge? I noticed that there is commit version for merge request, so I am worried if I simply make new pull request it will mess up something? Ideally I just want to redo the merging of the two requests.
Is there some other way to recover from this disaster? I learned the --force
is a really, really bad choice. :(
Update, example of what happened:
I have following branches:
master
feature1
origin/master
origin/feature1
I integrate two pull requests by using the GitHub's Auto merge pull requests
. Then, I didn't fetch the master
branch on my local machine. Thus, I think my origin/master
is two versions behind the remote master.
Then I accidentally used git -f push
, which overwrote the remote branch and now I lost the commits from the pull requests on remote repository.
How can I recover from it without messing up other contributors' history?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…