# Stash Latest (2.9) : Keeping forks synchronized

Added by pwatson , edited by mwatson on Jul 19, 2013

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.

## Attachments:

STASH26_fork_repo.png (image/png)
STASH26_fork_repo.png (image/png)
STASH26_sync_button.png (image/png)
STASH26_sync_button.png (image/png)
STASH26_sync_button.png (image/png)
STASH26_merge_strategy.png (image/png)
STASH26_discard_strategy.png (image/png)
STASH26_conflict_hints.png (image/png)