Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to PR and merge again after reverting PR using Github Revert Button

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 branch that I reverted earlier, but I was not able to do so. Steps as follow:

  1. PR to merge feature branch to master
  2. Revert PR merge from (master)
  3. Tried to create new PR to merge feature branch to master again.
  4. Got this message:

There isn't anything to compare.

master is up to date with all commits from feature-branch. Try switching the base for your comparison.

Any suggestions on how can I merge feature branch again into master

like image 367
Aboodred1 Avatar asked Jan 09 '15 00:01

Aboodred1


People also ask

What happens when you revert a merge request?

Revert a merge request After you select that button, a modal appears where you can choose to revert the changes directly into the selected branch or you can opt to create a new merge request with the revert changes. After the merge request has been reverted, the Revert button is no longer available.

How do I revert a commit already merged?

You can use the Git reset command to undo a merge. Firstly, you need to check for the commit hash (or id) so you can use it to go back to the previous commit. To check for the hash, run git log or git reflog . git reflog is a better option because things are more readable with it.

How to revert a PR in Git?

1 Go the the Revert PR and click "Revert" (But don't merge it) 2 Do git fetch 3 Do git checkout <name of revert's revert> More ...

How do I revert a pull request on GitHub?

Reverting a pull request on GitHub creates a new pull request that contains one revert of the merge commit from the original merged pull request. To revert pull requests, you must have write permissions in the repository.

How to revert a pull request after it has been merged?

You can revert a pull request after it's been merged to the upstream branch. Reverting a pull request on GitHub creates a new pull request that contains one revert of the merge commit from the original merged pull request.

How do I merge a pull request using GH PR?

To merge a pull request, use the gh pr merge subcommand. Replace pull-request with the number, URL, or head branch of the pull request. Follow the interactive prompts to complete the merge. For more information about the merge methods that you can choose, see " About pull request merges ."


1 Answers

Just revert the revert. So by clicking the revert button you will have created a new PR (your step 2). Once this is merged, you will have the option to revert this, which will create a new branch with all your changes back in. You can then pull this, make changes to it (if needed) and create a new PR. You will lose all the commit messages on Github, but all file changes will still be around. Good to refer to your original branch and reverts in the new PR.

Anything to avoid a complicated rebase or force pushing to master.

like image 198
Anthony Avatar answered Sep 19 '22 10:09

Anthony