Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Change default target repository on pull requests

kentwong
Contributor
February 19, 2021

When we create pull requests, the default repo is the parent repo from which we are forked from.

i.e. Repo A, and Repo B is a fork of A.

I create a pull request in Repo B, it sets up a default PR aimed at Repo A. The description field contains a diff between the two repositories (which you can imagine is a massive list) and this opens up opportunities for mistakes.

I don't see any options within Bitbucket to change the target.

13 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Tyler T
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 19, 2021

In this tutorial, in the first screenshot you can see that there is a dropdown for the target branch: https://support.atlassian.com/bitbucket-cloud/docs/create-a-pull-request-to-merge-your-change/

After you change the target branch, the diff will update.

kentwong
Contributor
February 19, 2021

No, my issue is the default target repository.  I've created an imaginary pull request diagram.

 

Our Repository is called "thisrepo", and it was forked from "parent_repo". When we open a PR from "thisrepo", the default target repository is "parent_repo" which we do not want. 

 

I've looked in Advanced settings and I only see an option for default target branch, which does not seem to affect the default target repository.

 

bitbucketproblem.png

Like # people like this
Tyler T
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 22, 2021

Does your repository need to be a fork? If you are not using the forking workflow, then you could clone the original repository (instead of forking it) and the default destination branch for pull requests would be the cloned copy rather than the original that was forked.

kentwong
Contributor
April 13, 2021

unfortunately we periodically use the fork workflows

Like Alexander Stukanov likes this
Jacek Ciach
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 23, 2021

@Tyler T Still nothing on that?

The "feature" is really annoying :/ (I cannot close the original repo - it's been already forked).

Tyler T
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 27, 2021

@Jacek Ciach I don't have any updates for you. I recommend voting for and following this public issue for updates: https://jira.atlassian.com/browse/BCLOUD-13645

Jason Harrison
Contributor
April 25, 2022

If you clone, then you lose all history of pull requests. If you fork then you preserve pull requests but are permanently stuck having to adjust PRs to merge to the new copy of the repository.

Like # people like this
Max DeCurtins
Contributor
June 23, 2022

@Tyler T this default behavior really, really needs to be changed.

Like # people like this
Alexander Stukanov October 21, 2022

@Tyler T why is Atlassian ignoring this for 6 Years?

Its obviously annoying your customers and made my decision clear to not choose your products for other projects.

19 votes
Koen Lavrijssen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 21, 2021

We would also appreciate it if we could change the default target repository.

Or if at least the default wouldn't be the forked repository, but the current repository.

11 votes
Max DeCurtins
Contributor
June 23, 2022

I've recently noticed this and DEAR GOD this is dangerous default behavior. The majority of PRs in a forked repo will be to the forked repo, not to the repo that was forked.

I would be pushing my org to use GitHub if the sunk cost on Atlassian products wasn't already so big, and baffling stuff like this is the reason why.

Seriously. Create a setting for default target repo on PRs for repos that were forked from a parent. Make the default setting to target the current repo, not the parent and let people change it if they really prefer the current behavior.

11 votes
dolf
Contributor
July 27, 2021

I really don't understand the rationale behind the bitbucket choice. The way everybody here describes using forks is also the way I would use them, and also the way github and gitlab use them iirc. I don't understand in what world it is useful to have RepoB forked from RepoA, and then make a new branch on RepoB but merge that into RepoA by default. If I want to merge something in RepoA, I would just make the branch there, not go through the trouble of making a fork into RepoB first. Especially because it's the default option, telling all developers that for every PR, they first need to make sure they select the right repository, is asking for someone to forget and b0rk a full repo at some point. 

dolf
Contributor
July 27, 2021

If this would be a setting in the repository at least, it would be acceptable. But right now forks are just dangerous imho. Somebody can quickly fork a repo to try something out, make a PR in their own repo, and inadvertently overwrite the source/parent repo. 

Max DeCurtins
Contributor
June 23, 2022

+1 to this. It's baffling why this is the default.

6 votes
Kevin Schorkops
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 5, 2022

Unbelievable that this has not been addressed since 2021... This is a horrendous & dangerous behaviour when forking a repository.

Is there any dev working at Atlassian to fix this mess or we can go f*** ourselves for this product we pay for?

6 votes
Jorge Pablos
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 20, 2022

+1, I cannot believe this has not been addressed for so long ..

As many people explained here, in our case we did a fork for some experimental changes that would not be ready to immediately be merged into the upstream, but we would need to iterate over them in the forked repo, and it is very annoying (even dangerous as expressed before) that the default target is the upstream ..

We should at least have the option to change this default behavior in the forked repo settings or the like.

Alexander Stukanov October 20, 2022

+ 1 @AtlassianTeam how can you ignore this, this is horrible

4 votes
j0um
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 14, 2021

I also believe the default repository should be the current repository. If it's not possible, adding an option to define the default repository would be great.

Max DeCurtins
Contributor
June 23, 2022

+1 to this

Like James Walsh likes this
4 votes
mattias.andersson.2
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 19, 2021

I subscribe to the sentiments expressed so far. In our case the rationale for using a fork is that we can occassionally sync changes from upstream into origin (and vice-versa). This is however by far less common than updating the actual fork itself. I don't see any problems with this kind of triangular workflow. In a big team this is a major hurdle since every new developer will have to get used to the routine of switching the default merge target. Why can't this be an option?

Max DeCurtins
Contributor
June 23, 2022

+1

Alexander Stukanov October 20, 2022

+1

2 votes
Charlie Choiniere
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 20, 2021

Any update on this? There doesn't seem to be a setting to set the default repository for pull requests.

2 votes
Rik van de Looi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 21, 2021

We use the fork workflow as well for a lot of our projects. We want to be able to get the changes from Repo A (main) back to Repo B (fork), so that's why a fork is useful.

However the changes we make in Repo B are always related to Repo B specifically. The PR's for Repo B should therefore always go to Repo B.

Besides the big list in the description of the PR it also slows down the PR page massively. I imagine this is because it tries to compute the changes between B and A (which is a lot). And because the page becomes so slow it's difficult to switch the target repository as the interface is very unresponsive for several seconds.

If you forget to change the target repository quickly you are basically stuck until the diff between B and A is computed and the interface becomes (somewhat) responsive again.

Having the default target repository be Repo B would resolve this issue. Another solution would be, as Kentwong suggests, that you are able to set the default target repository, just like you can set the default target branch.

1 vote
LoLei December 13, 2021

Since the JIRA issue mentioned somewhere in this thread is not directly related to this issue, I'd like to add my +1 here. We even accidentally merged PRs into the fork, after forgetting to change the target branch. Always changing the target branch from the fork to the current repo isn't enjoyable either.

0 votes
Jay Seletz
Contributor
October 28, 2022

+1

0 votes
Jeremy Nelson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 12, 2022

+1, Like, Upvote, whatever gets attention. Please fix this.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events