dslack
dslack

Reputation: 845

Re-merge reverted changes from a branch into master on Github?

I have two branches, bb and master. I worked on bb, made some changes, pushed them to Github, and made a pull request that I merged into master. I then saw a problem with a production app and thought there was a problem with the changes in bb, so I clicked the revert button on Github.

It turned out that the problem was not with the code but with a data file that was needed by the changes in bb that I hadn't uploaded to the server, so I wanted the changes from bb merged into master after all ... so, I made a meaningless change in bb (added some whitespace) to get a new PR. But the PR was just for the whitespace, not for all the other changes in bb relative to master. I merged the PR, but sure enough only the whitespace change was applied.

So now Github has two versions of a file foo.py, one in bb and one in master, and when I try to make a pull request, it tells me that "There isn’t anything to compare. master is up to date with all commits from bb". Huh?

How can I get Github to actually merge the changes from foo.py in bb into master? (I think it's thrown off because it has previously merged exactly these changes ... but the current state of foo.py in master is different from in bb.)

Upvotes: 0

Views: 938

Answers (1)

Daniel Humfleet
Daniel Humfleet

Reputation: 609

Your easiest fix is to head to the terminal. Checkout the project if you haven't already.

git clone <url> my_project
cd my_project
git log (Find the id of the revert-- which is just a commit)
git revert (commit_id)

Then push your changes to bb and create a pull request for master

Upvotes: 3

Related Questions