2

I successfully merged a PR into master. When I inspect master in GitHub, the changes are not shown, yet GitHub says that the merge into master was successful.

I am trying to get the content of (at this point) ANY of these branches into master: new_react_in_nav_bar_branch, revert-16-add_react_to_nav_bar, or add_react_to_nav_bar (ideally, the first of these three). I have made a huge mess of things.

The repo can be found here.

This is the output of git log --all --oneline --decorate --graph:

*   e824c42 (HEAD -> master, origin/master, origin/HEAD) Merge pull request #19 from noahmilstein/new_react_in_nav_bar_branch
|\
| * 8626d40 (origin/new_react_in_nav_bar_branch) fixed codeship build failure
| * 1ca3f73 added capybara webkit
* |   9ca1f50 Merge pull request #17 from noahmilstein/revert-16-add_react_to_nav_bar
|\ \
| * | 390c5e1 (origin/revert-16-add_react_to_nav_bar) Revert "Add react to nav bar"
|/ /
* |   81c87d1 Merge pull request #16 from noahmilstein/add_react_to_nav_bar
|\ \
| |/
| | * 8406ea5 (origin/add_react_to_nav_bar) added capybara webkit
| |/
| * a66de71 nav bar is now react
| * df8319c (origin/fix_tagging) WIP, waiting on SOF answer
|/
*   136e6ec Merge pull request #15 from noahmilstein/add_react
Scott Weldon
  • 9,673
  • 6
  • 48
  • 67
n.milsht
  • 163
  • 3
  • 17
  • Possible duplicate of [Re-doing a reverted merge in Git](http://stackoverflow.com/questions/1078146/re-doing-a-reverted-merge-in-git) – Scott Weldon Oct 21 '16 at 23:13

2 Answers2

0

This situation occurred because you:

  1. Merged add_react_to_nav_bar into master.
  2. Reverted that merge in commit 390c5e1. In the future, try to avoid reverting a merge, see below.
  3. Merged new_react_in_nav_bar_branch, which is based on add_react_to_nav_bar, into master.

As explained in the Git docs, reverting a merge reverts the changes, but it doesn't change the history, so Git still sees that the original merge occurred. Thus, Git ignores any changes from before that merge, because those changes have already been merged once.

To work around this, as explained in Re-doing a reverted merge in Git, you have to revert the revert (in this case 390c5e1. Do:

git revert 390c5e1

(If you want, you can create a new branch first, and submit that branch as a PR.)

In the future, instead of reverting a merge, if possible, try to find the specific commit that is faulty (git bisect can be helpful here) and revert that. If you have no choice but to revert the merge, then you can use the above solution.

Graham
  • 7,431
  • 18
  • 59
  • 84
Scott Weldon
  • 9,673
  • 6
  • 48
  • 67
  • I couldn't seem to get that to work. I resolved this issue but it was rather ugly workaround. – n.milsht Oct 22 '16 at 03:26
  • @n.milsht What happened when you tried my solution? How did you resolve your issue? For the latter, feel free to [self-answer](//stackoverflow.com/help/self-answer) your question. – Scott Weldon Oct 22 '16 at 17:38
0

I didn't exactly solve this so much as work around it in a rather sloppy fashion. The changes I wanted to commit weren't extensive so I branched off of master and just copied the changes I wanted to commit into this new branch. Not exactly a solution but I couldn't waste anymore time on the problem.

n.milsht
  • 163
  • 3
  • 17