Allow pull request receiver to change destination branch (BB-3232)

Issue #3369 open
Anonymous created an issue

Currently, during a pull-request it is not possible to change the destination branch to be a different branch than the issuer specified.

It is possible to create a new branch on pull with the same name as the source branch, but this must be done on the issuer side. If the issuer is proposing a merge into master, I don't necessarily want the code to be merged into master without running my own test suites.

The request can be rejected and then asked to change the destination branch, but this is clunky. I could pull directly from their repository, into my local copy before pushing to my online repository but this makes it more difficult to perform larger peer reviews --> telling everyone to pull from that branch instead of just pulling the latest copy from the blessed repository is not intuitive. I also cannot do this if their fork is private.

I propose the owner of the destination repository should be able to change the destination branch before pulling into his repository from the pull-request UI.

This is how I work locally when interacting with colleagues in my office, so being able to work like this from Bitbucket would be very convenient.

Comments (20)

  1. Erik van Zijst staff


    It seems I've found a work-around. The problem is the following: when I created a fork with a test user, I unchecked "Inherit repository user/group permissions". I that case I didn't have any rights (read/write/admin) for the created fork.

    Now If I log in with a created user and add read/write rights for my main account, I'll get "Edit" button on a "Pull Request" page and I'll be able to change a branch I want the code to merge into. I don't think it's a right case, I suppose I should have a chance to change a branch despite my access rights.


  2. Simon Hampel

    As mentioned briefly by the original poster, there is a workaround for this - it's cumbersome, but it works for simple requests.

    If you have read access to the requester's repository, you can add their repo as a new remote in your Git client, then pull the branch from their repo into which-ever branch you choose locally.

    Then, you make your changes and once you are happy, merge into master or where-ever.

    Once you push all the changes back to Bitbucket, Bitbucket is smart enough to detect that the pull request has been merged and will automatically mark it so.

    It's not ideal - especially if you get lots of pull requests or you need peer review - and it DOES require read access to the source repo (which isn't a given), so it would be much better to simply allow the repo owner to change the destination branch for pull requests, as requested by the OP.

  3. Bob Ray

    This is critical for me. I get many pull requests from contributors to merge changes into my master branch. They don't belong there until I test them, and I can't test them until I merge them into a branch.

    When a contributor does a lot of work and submits a number of PRs, I don't feel I can ask them to resubmit all of them to a different branch.

  4. Randle Taylor

    Just wanted to add my voice saying this would be a nice feature to have. It's not too bad to have to do it just using git but it would be nice to do it from the BitBucket ui.

  5. Ed McDonagh

    Is there any chance of some progress on this? I like to encourage new contributers too fork the repo and send a pull request, which is invariably to my develop branch. But I can't try it out or run my test sits on it until after it is merged, so I need to be able to create a branch and merge it in. But as I can't change the destination branch, this workflow becomes extremely clunky, either by creating a branch and asking the contributor to change it from their end, or I have to add their repo to my client and check it out locally before merging to a new branch to test.

  6. Log in to comment