When creating a Pull Request in a Fork repository the default target branch is from the original repository

When creating a Pull Request in a Fork repository the default target branch is from the original repository.

Example:

I have a repository "main-repo" with "master" and "feature1" branches.

I forked this repository into "repo-fork-1".

If I go to the "feature1" branch in the "repo-fork-1" and enter in the "compare" view, it shows the diff between this branch (as source) and the "master" branch in original repository "main-repo" (as target). If I press then "Create Pull Request", the Pull Request is created in the target repository.

Even I can change this before creating the Pull Request, one can easily create the Pull Request for the wrong target branch (i.e., the same branch name but in the wrong repository), since it's not expected that it will choose the original repository as default. In my opinion this is wrong.

Is there already an issue opened for this?

3 answers

@Roger Barnes my team is experiencing the same problem - our use case is that we have a template / scaffolding project that gets forked whenever a new project is created to save on a lot of boilerplate in initial development. Now any PRs created on the forked projects default to targeting the template project, which is not what we want. Is there any way to change this behaviour in an existing project?

The same thing. We have a template and creating forks for new projects. Any updates on that, guys?

Roger Barnes Atlassian Team Oct 30, 2017

Forks are designed for a specific purpose and not intended for seeding new, unrelated repositories. As such, they don't and won't work that way by default.

Project level settings are now available in Bitbucket Server (from 5.2) so you can create a regular repository within a project that inherits settings.

If it is repository content that you wish to use as a template, I suggest cloning and pushing the contents to a regular repository, or using an add-on such as: https://marketplace.atlassian.com/plugins/ch.mibex.stash.templates/server/overview

Neil Roza I'm New Here Nov 14, 2017

When can we create pull requests with _NOT_ forks?

0 votes
Roger Barnes Atlassian Team Oct 25, 2015

Hi Silvestre, Forks are commonly used as a means for contributing changes back to the upstream repository, hence the default of referring back to it. Under what circumstances do you have multiple people collaborating on a single fork where changes end up in the same repository? It seems an unusual situation, or perhaps an unusual use of pull requests.

You're right. I was creating Pull Requests on a Fork repository because I was doing tests. In a real scenario this should not be a problem. Thanks for the explanation.

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...

650 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