Undo a merge by pull request?

Viewed 325430

Someone accepted a pull request which they shouldn't have. Now we have a bunch of broken code merged in. How do you undo a pull request? I was just going to revert the changes to the commit just before the merge, but I noticed that it merged in a bunch of commits. So now there are all these commits from this person from days before the merge. How do you undo this?

8 Answers

If you want to undo the pull request so we can follow these steps-

List of activities all pull request -

git reflog

enter image description here

After running the above command this output will occur.

then run reset command-

git reset --hard 6954dff92

where 6954dff92 merging id, and your code updated based on the merge id.

Thanks, I hope it will be help, please like and support.

If you give the following command you'll get the list of activities including commits, merges.

git reflog

Your last commit should probably be at 'HEAD@{0}'. You can check the same with your commit message. To go to that point, use the command

git reset --hard 'HEAD@{0}'

Your merge will be reverted. If in case you have new files left, discard those changes from the merge.

Related