5

If a Pull request is merged (say PR3) and on top of that couple of more Pull requests (say PR4, PR5 etc.) have been merged that made changes to the same file in the previously merged Pull request PR3, Now I want to revert the Pull request PR3 and Git is not allowing me to do that automatically and giving this error.

Sorry, this pull request couldn't be reverted automatically. It may already have been reverted, or the content may have changed since it was merged.

How Should I revert pull request PR3?

vinodsaluja
  • 573
  • 6
  • 15
  • 1
    If you are in GitHub, you can try [this](https://help.github.com/en/articles/reverting-a-pull-request).or [this](https://stackoverflow.com/questions/2389361/undo-a-git-merge-that-hasnt-been-pushed-yet/6217372#6217372) – Jalil Apr 19 '19 at 06:59
  • Tried in Github, gives the error as mentioned in the question, and the PR contains lots of commits and not just one. – vinodsaluja Apr 19 '19 at 07:09
  • So also everything thats in PR4 and PR5 is wrong? because you already made some changes there – Jalil Apr 19 '19 at 08:33
  • not exactly, those changes are not wrong. those could be in different methods/functions. – vinodsaluja Apr 19 '19 at 10:28
  • [revert locally](https://stackoverflow.com/a/43245886/2303202) – max630 Apr 21 '19 at 05:39

1 Answers1

2

Let's say then that you can create a new branch with all the content.

Then in your main branch you start doing reverses.

$ git revert --no-commit PR5
$ git revert --no-commit PR4
$ git revert --no-commit PR3
$ git commit -m "NO PRS"

Then in your new branch you save whatever you need. And merge with your main branch.

Jalil
  • 1,167
  • 11
  • 34