How to prevent updates to pull request

Is there any plugin to control the updates to an open pull request? Once the requester has submitted the pull request for a branch, they should not be able to update it. Either the pull request is to be automatically denied or should prevent updates to the branch.

4 answers

As well as the plugin Balazs suggested, there is another Add-on you will likely find useful called ScriptRunner for Stash.

You can read the documentation about the functionality, ScriptRunner for Stash too can withdraw approvals whenever a Pull Request changes.

It also gives you the ability to control a number potentially undesired events as a Pre-Hook (i.e before the git push is successful).

There is a short video available about the typical Pre-Hooks you might use so you can quickly assess if you might find it useful. The other functionality you will likely find useful is the Auto Add Reviewers to Pull Requests video.

I hope it helps.

This sounds like a) overkill for the task at hand (both in price and complexity) and b) an advertisement for your product rather than an actual answer to the question.

Balazs, thanks for your comment. a) I thought I'd give Harish the information. b) yes, it is an advert with the intent of helping at the same time. Perhaps next time I will stick to answering the question and not throw in extra features.

Why? That appears not productive to me. There is a plugin to automatically unapproved on updates, I find that more useful.

In a sense that when the requester has sent me a request to merge, the branch is considered to be finished and ready there should be no more updates to it. Let us say that the approver has approved the request, in the time between approving and merging , any more updates should not be accepted.

In general, pull requests have to be updateable, otherwise it would be impossible to fix problems with the code changes discovered during review. To make sure that only the approved changes actually get merged, you can do either of these:

  • Have the reviewer merge the PR, right after approving it
  • Install this plugin and then in the pull request settings of the repo:
    • set "Requires N approvers" to 1 (or more) and enable it
    • also enable "Unapprove all reviewers when the source branch of a pull request changes"

N.B. In both of these cases, it is still possible to remotely merge(*) the pull request with unapproved changes, as long as the author has write access to the target branch.

(*) Merge the source branch to the target in a Git client and push the merge commit.

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

684 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot