LinuxCommandLibrary

dolt-fetch

Download objects and refs from another repository

TLDR

Fetch the latest changes from the default remote upstream repository (origin)

$ dolt fetch
copy

Fetch latest changes from a specific remote upstream repository
$ dolt fetch [remote_name]
copy

Update branches with the current state of the remote, overwriting any conflicting history
$ dolt fetch -f
copy

SYNOPSIS

dolt fetch [remote] [refspec]...

PARAMETERS

remote
    The name of the remote repository to fetch from. Defaults to 'origin' if not specified.

refspec
    Specifies which branches or tags to fetch.
Can be a branch name, a tag name, or a refspec in the form `[+]:`. If not specified, fetches all branches and tags from the remote.

--all
    Fetch all remotes.

--depth depth
    Limit fetching to the specified number of commits from the tip of each history.

--force
    When dolt fetch refuses to update an existing branch, using this option will override this safety, and allow the update.

--prune
    After fetching, remove any remote-tracking references that no longer exist on the remote.

DESCRIPTION

The `dolt fetch` command is analogous to `git fetch`. It downloads objects and refs from another repository.

Specifically, `dolt fetch` updates the local database's remote tracking branches (e.g., `origin/main`) to reflect the latest state of the remote repository. It does not automatically merge these changes into your local branches. You'll typically follow `dolt fetch` with `dolt merge` or `dolt rebase` to integrate the fetched changes.

Dolt fetch is essential for keeping your local Dolt database synchronized with a remote repository, enabling collaboration and preventing conflicts.

CAVEATS

Unlike Git, Dolt does not allow fetching of individual commits by their SHA. You must fetch a branch or tag that contains the desired commit.

REFSPECS

A refspec defines the mapping between remote and local branches during fetch and push operations. The format `[+]:` means: fetch from the remote branch `` and update the local branch ``. The `+` symbol indicates a force update, allowing non-fast-forward updates.

SEE ALSO

dolt push(1), dolt pull(1), dolt merge(1), dolt remote(1)

Copied to clipboard