Skip to content
[ 03 ]Commands

copia-cli repo sync

copia-cli repo sync [<destination-repository>] [flags]

Sync destination repository from source repository. Syncing uses the default branch of the source repository to update the matching branch on the destination repository so they are equal. A fast forward update will be used except when the --force flag is specified, then the two branches will be synced using a hard reset.

Without an argument, the local repository is selected as the destination repository. The source repository is --source, or else the default repository (the remote marked by repo set-default, else origin), and must be one of the git remotes.

With an argument, the remote repository, a fork, is synced from its parent on the server, fast-forward only. Copia (app.copia.io) does not offer fork sync through its API, so there the remote mode fails with an error; it works against a Gitea-compatible server that serves the merge-upstream endpoint.

Options

-b, --branch <string>
Branch to sync (default [default branch])
--force
Hard reset the branch of the destination repository to match the source repository
-s, --source <string>
Source repository

Options inherited from parent commands

--host <string>
Target Copia host
-R, --repo <string>
Select repository (owner/repo)
--token <string>
Authentication token

Examples

# Sync local repository from the default repository
$ copia-cli repo sync

# Sync local repository from the default repository
# on a specific branch
$ copia-cli repo sync --branch v1

# Sync local repository from another remote,
# overwriting local commits
$ copia-cli repo sync --source upstream-org/project --force

# Sync remote fork from its parent
$ copia-cli repo sync owner/project-fork

See also