0

I want to revert my pull request changes in master protected brach which accept changes only through pull request

I tried

git revert -m 1 commit code
git checkout -b rollback_branch
git add .
git commit -m 'rollback'
git push  

When I opened a new pull request from rollback branch to master it says there are no changes in Diff tab.

Mohammed
  • 334
  • 1
  • 5
  • 22
  • 1
    Refer to the documentation for git revert, `Reverting a merge commit declares that you will never want the tree changes brought in by the merge. As a result, later merges will only bring in tree changes introduced by commits that are not ancestors of the previously reverted merge. This may or may not be what you want.` https://stackoverflow.com/questions/7099833/how-to-revert-a-merge-commit-thats-already-pushed-to-remote-branch might give more context. – gpk27 Jul 19 '19 at 09:57
  • Did you specify the correct commit hash in your revert? Did you specify the correct parent after -m? Does your commit actually rollback the changes as expected? A lot of possibilities for failure here. – InfiniteHigh Jul 19 '19 at 11:26
  • Yes, the problem was I cann't see any difference between my branch and master when I create new PR from the reverted branch – Mohammed Jul 19 '19 at 11:29
  • If your master branch is configured on github to only accept changes through a pull request, and you have committed to it locally, you can't simply revert the changes as that will add an additional commit. Github will prevent pushes with new commits, regardless if the end result introduces changes or not. – Lasse V. Karlsen Jul 26 '19 at 12:46

0 Answers0