4

I have reverted a pull request from GitHub by following this article https://help.github.com/articles/reverting-a-pull-request/. Now even after reverting when I am comparing the two branch it shows same. How can I raise a pull request again?

Here is what I did

  1. I raised a pull request from prod_bug_fix branch to release/13.0.0 and went to github and merged.
  2. Then I followed the above article and unmerged the pull request. Now I thought release/13.0.0 code would be back as before I raised the pull request.
  3. I tried raising a pull request again from prod_bug_fix to release/13.0.0 but it says "There isn’t anything to compare." . But I can see there are code differences between the two branches.

What I did wrong and how I can make release/13.0.0 to same state as before?

antnewbee
  • 1,779
  • 4
  • 25
  • 38
  • 1
    Check the history on `release/13.0.0` and see if it contains the commits for `prod_bug_fix`. If reverting pull requests is implemented using `git revert`, it'll look like the commits have already been merged. – Stephen Newell Mar 20 '18 at 14:04
  • Hi Stephen, yes r/13.0.0 does have the commits from prod_bug_fix. What can be done now? – antnewbee Mar 20 '18 at 14:11
  • 1
    Maybe revert the reverts? I'm guessing here, so test carefully. – Stephen Newell Mar 20 '18 at 14:18

3 Answers3

2

A little late on this answer, but I encountered this issue myself and finally tracked down that the revert behaves weirdly in that the original commit being reverted is still in the history, so when you go to create a new PR it still thinks it is in there so you see no difference when doing the diff. This StackOverflow answers gives some more details about it.

Zoltorn
  • 171
  • 1
  • 2
  • 10
0

Since the merge you reverted will always be in the history, you'll need to replay that merge onto prod_bug_fix before submitting your new PR.

First, get prod_bug_fix up to date by checking it out and doing git merge **release/13.0.0** (this will probably be a simple fast forward merge).

Now let's say that the merge you reverted had hash abc123; you would replay all the changes to that merge onto prod_bug_fix with git cherry-pick -m 1 abc123. The -m 1 tells git "replay the changes that were made to the first parent of the merge (release/13.0.0) as opposed to the changes made to the second parent (prod_bug_fix). Once you have done this, a PR from prod_bug_fix to release/13.0.0 will work as expected.

David Deutsch
  • 17,443
  • 4
  • 47
  • 54
0

Revert will create a new commit that undoes the specified commit. It doesn't remove the specified commit, it just creates a new commit on top of your commit to remove your changes. That's why when you check diff between the branch there will be none because the commit is already present in the branch.

For eg:

Branch A => commit1 => commit2 => commit3

after reverting, commit order will be

Branch A => commit1 => commit2 => commit3 => commit4(this is your revert commit)

ritesh
  • 177
  • 2
  • 4