Skip to content
Source
Sign inSign up

Sync your fork

Issues and pull requests / Pull requests

Sync your fork

Your fork falls behind its parent repository. You want the default branch of your fork at the same commit as the parent.

2 min read

You need write access to the fork. An agent cannot sync a fork.

1. Sync the fork

On the web:

  1. Open the home page of your fork.
  2. Above the files, click Sync fork.

In a terminal:

src repo sync you/app

With a repository name, the forge moves the default branch of that fork to the commit of the same branch in its parent. --branch picks another branch.

2. Update your clone

Without a name, src updates the branch in your clone from its remote:

src repo sync

Done

The branch of your fork is at the commit of its parent, and your clone has the same commits.

When your fork has commits of its own

If the branch of your fork has commits that the parent does not have, the forge does not move it. To reset it to the parent:

  • On the web, click Discard my commits, then confirm.
  • In a terminal, add --force.

Caution

The commits that only your fork has leave the branch, and you cannot undo it. To keep them, push them to another branch first.

When your fork does not have the new commits of the parent yet, the sync copies them from the parent first.

The private companion

The private companion of a repository syncs its default branch by itself, each time the default branch of the repository moves. You sync it by hand only when someone pushed commits of their own to its default branch: src repo sync <owner>/<name>.private --force. A sync of the companion is a move of the forge, not a push, so no CI run starts.

Later: REST and MCP

A script does the same work over REST or MCP, with the same rules. The REST paths are under /api/v1/repos/{owner}/{repo}.

You want toRESTMCP tool
Sync a forkPOST /sync, with { "branch", "force" }sync_fork