Keeping forks synchronized

Using forks in Bitbucket Server

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

Fork syncing helps you to keep your fork in Bitbucket Server up-to-date with changes in the upstream repository. Bitbucket Server can do this automatically for all branches and tags you haven't modified in the fork.

If you have modified branches or tags in the fork, Bitbucket Server will offer syncing strategies. Bitbucket Server will never update your branch or tag in your fork if this means that your changes would be lost.

Note that syncing is about pulling recent upstream changes into your fork, whereas pull requests are about pushing your changes back to the upstream repository.

On this page:

Enabling automatic fork syncing

You can enable automatic fork syncing when you first fork the repository:

  1. Enable fork syncing

You can also enable fork syncing at any later time by going to Settings > Fork syncing for the forked repository. Syncing is enabled by default.

What gets synced?

When performing automatic synchronization, Bitbucket Server updates the fork as follows:

  • for branches - Bitbucket Server makes any fast-forward change, where there is no need to merge work and there is no risk of losing changes.
  • for tags - Bitbucket Server makes updates only if the current state is the same as what upstream pointed to. So, a new tag in upstream will create a new tag in the fork, unless you have a tag of the same name, when the update will fail.

Manual syncing

If upstream and your fork have diverged, so that each has changes that are not in the other, Bitbucket Server will not perform a merge automatically. When you visit the branch in Bitbucket Server, you have the option to manually synchronize the branch.

You can manually synchronize your branch at any time using Synchronize by going to the Settings > Fork syncing tab for the forked repository, or on either of the Source or Commits tabs for a repository:

Manual synchronization strategies

When you initiate a manual synchronization, Bitbucket Server will ask you to choose one of the following synchronization strategies.

Merge strategy

Merge the upstream branch into the fork branch.

If Bitbucket Server detects conflicts when trying to perform the merge it will offer hints on how to resolve those:

Once the merge is complete, your branch will have incorporated all the commits on the branch in the parent repository, but your branch will still be ahead of the parent (it has your changes on it). This means automatic synchronization for this branch will not occur until your changes are pushed to the parent repository.

Discard strategy

Overwrite your changes in your fork with the upstream branch. Your changes will be lost.

Last modified on Nov 17, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.