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

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 ?


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.