Stash is now known as Bitbucket Server.
See the

Unknown macro: {spacejump}

of this page, or visit the Bitbucket Server documentation home page.

Fork syncing helps you to keep your fork in Stash up-to-date with changes in the upstream repository. Stash 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, Stash will offer syncing strategies. Stash 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:

 

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

What gets synced?

When performing automatic synchronization, Stash updates the fork as follows:

  • for branches - Stash makes any fast-forward change, where there is no need to merge work and there is no risk of losing changes.
  • for tags - Stash 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, Stash will not perform a merge automatically. When you visit the branch within Stash, you have the option to manually synchronize the branch

You can manually synchronize your branch at any time using Synchronize on either of the 'Files' or 'Commits' tabs for a repository:

Manual synchronization strategies

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

Merge strategy

Merge the upstream branch into the fork branch.

If Stash 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.

  • No labels