Basically I used Github revert button to revert a previous PR for a feature branch into master
, then I decided to merge the same feature br
I am writing this answer since I faced this issue and I found the answers here more theoretical than practical. I surfed a little bit more and found the method to tackle this issue. You can find a more detailed answer in the article here.
To solve this problem you have to create a new branch tracking the master and revert the revert commit. Then checkout to feature branch and merge the new branch. Now you can resolve conflicts (if any), commit and create a new PR.
Here are the commands:
# do the needed changes in the feature branch
$ git commit -m "fixed issues in feature-branch'
# create new branch tracking master branch
$ git checkout -b revert-the-revert-branch -t master
# revert the reversion commit
# find it from your git log
# in linux try: 'git log | grep revert -A 5 -B 5'
$ git revert
# checkout the original feature branch
$ git checkout feature-branch
# merge the revert branch
$ git merge revert-the-revert-branch
# handle merge conflicts and commit and PR