Question

After forking a repository in BitBucket, the new repository is linked to the original (upstream) one. It's mentioned in a form of "fork of XXX/repository" under repository name, but also it's possible to create pull requests to the upstream repo only. My team changed organization of repositories and now the "main", upstream repository is somewhere else. Is it possible to change the upstream of a repository in BitBucket, so I'll be able to create pull requests to a different repo?

To clarify, previously it was like this: there was a central repository steven/project-name, our application was built from master branch of that repository. The workflow was that every team mamber forked this repo (so I forked it to toonczyk/project-name) and worked on those forks, then created pull requests to steven/project-name. Now the structure changed and our "main" repo is organization/project-name, so that's where I should send my pull requests, unfortunately you can only send pull requests to a repository you originally forked from (in my case steven/project-name). How do I change that? Should I just delete the repository and create a new fork?

Was it helpful?

Solution

Should I just delete the repository and create a new fork?

Yes, and you can change the remote 'origin' of your local repo to point to that new fork.

git remote set-url origin https://url/of/your/new/fork

The OP toonczyk adds in the comments:

  • Actually origin doesn't change in my local repository, as it remains called toonczyk/project-name.

  • Also it seems safer not to delete the repository in Bitbucket, but to just rename it instead (to something like toonczyk/project-name-old).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top