wrgl fetch

Download objects and refs from another repository.

wrgl fetch [REPOSITORY [REFSPEC...]] [flags]

Fetch branches and/or tags (collectively, "refs") from another repository, along with the objects necessary to complete their histories. Remote-tracking branches are then updated.

If REPOSITORY is not specified then "origin" is assumed. If REFSPEC are not specified then they are read from remote.<repository>.fetch config.



Fetch all remotes.

-d, --depth

The maximum depth pass which commits will be fetched shallowly. Shallow commits only have the metadata but not the data itself. In other words, while you can still see the commit history, you cannot access its data. If depth is set to 0 then all missing commits will be fetched in full.

-f, --force

Force update local branch in certain conditions.

-h, --help

help for fetch


Don't display progress bar

Inherited flags


set Badger log level, valid options are "error", "warning", "debug", and "info" (defaults to "error")


write cpu profile to file


print debug logs to stdout


print debug logs to the given file instead


write heap profile to file


parent directory of repo, default to current working directory.


# fetch the main branch from origin
wrgl fetch origin refs/heads/main:refs/remotes/origin/main

# fetch multiple branches with glob pattern
wrgl fetch origin refs/heads/*:refs/remotes/origin/*

# fetch from origin, reading refspec from remote.origin.fetch
wrgl fetch

# fetch and force update a single branch
wrgl fetch +refs/heads/main:refs/remotes/origin/main

# fetch and force all non-fast-forward updates
wrgl fetch my-repo --force

# fetch the first 2 commits in full, fetch the rest shallowly
wrgl fetch origin refs/heads/main:refs/remotes/origin/main --depth 2

How refspecs are interpreted

Each refspec has the form <remote ref>:<local ref>. The remote ref in the refspec must match actual refs at the remote of course. If the remote ref in the refspec is a glob pattern then the local ref must also be a glob pattern (e.g. refs/heads/*:refs/remotes/origin/*).

If the local ref exist and is an ancestor of the remote ref then the update is called "fast-forward". If the local ref exist but it is not an ancestor of the remote ref then the update is called "non-fast-forward". Non-fast-forward updates are denied by default, unless --force flag is specified or if refpsec is prefixed with a + (e.g. +refs/heads/main:refs/remotes/origin/main).