Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop github from adding new commits to existing pull request

Tags:

I have created a pull request from my master branch to upstream and now every new commit on that branch automatically attaches itself to this pull request.

There was a "Change commits" button on pull request page at the time of creation but it seems to disappear after request is created. Can I do it some other way now ?

like image 526
Marcin Wisnicki Avatar asked Jul 27 '12 10:07

Marcin Wisnicki


People also ask

How do you exclude changes from a pull request?

To exclude certain files from appearing in pull requests: In the repository containing the pull request, click Repository settings > Excluded files in the Pull Requests section. In the Patterns field, enter patterns to exclude from pull request diff views. Click Save.

How do I make changes to an existing pull request?

The current way to update a pull request is to click on the “Edit” button along the other pull request action buttons. This will bring you to the update pull request page where you can make changes to the title, description, reviewers and specify whether to close the branch after the pull request has been merged.

Can I Unapprove a pull request?

Description. When a pull request is created and approved, if more changes are pushed then it makes sense to unapprove the pull request. So that the user could review the new changes and approve them. Else there is a chance that the merger could think that everyone approved and it is ready to be merged.


1 Answers

In GitHub a Pull Request denotes the request to merge one branch with another. When either branch is updated, the pull-request is updated too and the merge is re-evaluated.

Thus, when you push new changes to a branch that has an outstanding pull request linked to it, the pull request will be updated to include the new changes.

To reset your pull request to a previous state you can:

   git switch branch-you-want-to-fix    git branch backup-of-later-changes    git reset --hard hash-of-desired-changes    git push --force 

This rill create a new local branch with your later changes and will remove those changes from the branch on github.

The pull-request will be re-evaluated (one of its sides has been updated with your force push), and you can create a new pull request from your backup-of-later-changes branch.

As long as the new commits aren't pushed to the pr-branch, they won't automatically appear in it, even if these changes are based on top of your original pr-branch.

like image 93
jessehouwing Avatar answered Oct 05 '22 23:10

jessehouwing