Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating pull request after revert

Tags:

git

github

First question so I'm going to try to get this correct.

I created a branch and was working on a project for a couple of weeks. I created a pull request to merge my branch with the master branch. When my branch was merged with master it created a lot of various issues (whoops lots of emails in the morning). So, my pull request was reverted and the next day I corrected the issues and pushed back to my branch. However, when attempting to create the pull request, it does not recognize the changes prior to the revert.

I've attempted 'git checkout (sha for previous commit)' and then 'git checkout -b (new branch)'. That did not work. I attempted to use cherry pick, but I'm not confident I did that correctly.

Any suggestions would be greatly appreciated!

like image 659
LewisW Avatar asked May 20 '16 14:05

LewisW


1 Answers

Simple Answer, you have two options here:

First, stash your new changes, then either

Option 1 - Create a new branch, and cherry-pick all your changes from your old branch, search on how can you cherry-pick a range of commits.

OR

Option 2 - If you don't want to create a new branch, you will first need to pull in the latest changes from the mainline (including your reverted commit). Then essentially revert your reverted commit in your branch.

Then, stash pop your changes, and commit. Now your pull request will reflect all your changes.

Essentially, the pull request, gets all the commits when you had last separated from mainline.

like image 59
Abdullah Khilji Avatar answered Sep 21 '22 17:09

Abdullah Khilji