How to auto sync forked repositories in Bitbucket Cloud
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
Currently, Bitbucket Cloud supports manual syncing of forks. When the parent of the fork is ahead, a notification on the right sidebar "Sync (1 commit behind)" indicates that the fork is behind and provides a way to sync the changes.
Solution
The following steps could be followed to sync the changes from the parent repository to the forked repository.
Add a remote upstream repository (Parent of the forked repository) that will be synced with the fork.
1
$ git remote add parentrepo https://USERNAME@bitbucket.org/WORKSPACEID/REPOSLUG.git
Fetch the branches and the commits from the parent fork repository.
1
$ git fetch parentrepo
Once the commits are fetched from the parent repository, check out the forked repository's local master/main branch.
1
$ git checkout master
Merge the changes from parentrepo/master into your local master branch and push the changes.
1 2
$ git merge parentrepo/master $ git push
Was this helpful?