How to create a new repository on every release branch
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
When working on a repository and managing release branches, users might prefer to deal with each branch as its own separate repository, completely unrelated to its original repository.
Environment
This article is related to Bitbucket Cloud only.
Solution
For these cases, this can be achieved by following these steps:
- Create a new repository to host the "release" version of your main repository;
Perform a mirror clone of the original repository
$ git clone --mirror <repo_url>
Navigate to the mirror clone and change the local remote URL to the "Release" repository
$ cd repository.git $ git remote set-url origin <release_repo_url>
Force push the contents of the mirror clone to the new remote
$ git push -f