dolt-fetch
Download objects and refs from another repository
TLDR
Fetch the latest changes from the default remote upstream repository (origin)
Fetch latest changes from a specific remote upstream repository
Update branches with the current state of the remote, overwriting any conflicting history
SYNOPSIS
dolt fetch [options] [remote [refspec...]]
dolt fetch --all [remote...]
PARAMETERS
remote
The name of the remote repository to fetch from. If omitted and --all is not specified, Dolt fetches from all configured remotes.
refspec
Specifies which remote references (branches, tags) to fetch and where to put them locally. It's typically in the format [+]<src>:<dst>. If not provided, Dolt uses default refspecs configured for the remote.
-a, --all
Fetch from all configured remotes.
-p, --prune
After fetching, remove any remote-tracking branches that no longer exist on the remote. This cleans up stale references.
-f, --force
When using a refspec, allow updates to a local ref that is not a fast-forward. This can overwrite local remote-tracking branches, use with caution.
-n, --dry-run
Perform all operations except actually sending the updates. Shows what would happen without modifying the repository.
-v, --verbose
Be more verbose during the fetch operation, showing more details about the process.
--no-tags
Do not fetch tags from the remote repository, even if the default refspecs would otherwise fetch them.
DESCRIPTION
dolt fetch is a command in the Dolt version-controlled SQL database that mirrors the functionality of git fetch. It is used to download branches and their associated commit history from one or more remote Dolt repositories to your local Dolt repository.
Unlike dolt pull, which fetches and then immediately merges changes into your current working branch, dolt fetch only downloads the data. It updates your local remote-tracking branches (e.g., remotes/origin/main) to reflect the state of the remote repository's branches. This allows you to inspect changes from the remote without altering your local working branch, providing a safe way to see what's new before integrating it. It's a crucial step for keeping your local database repository synchronized with remote collaborators and for preparing to merge remote changes.
CAVEATS
dolt fetch only downloads data; it does not automatically merge changes into your current working branch. To integrate changes, you typically follow a fetch with a dolt merge or use dolt pull for a combined fetch-and-merge operation. Ensure you have remotes configured using dolt remote add before attempting to fetch. Fetching can download a significant amount of data, increasing local repository size.
DATABASE VERSION CONTROL
The primary distinction of dolt fetch compared to git fetch is its application to a SQL database. It fetches schema and data changes, allowing users to track and manage evolutions of their database structure and content over time as commits and branches. This enables collaborative development on database schemas and data sets.
REMOTE-TRACKING BRANCHES
When you fetch from a remote, dolt fetch updates 'remote-tracking branches' (e.g., remotes/origin/main). These branches are local copies of branches on the remote repository. They serve as bookmarks to show the exact state of the remote branches at the time of the last fetch. Your local working branches (e.g., main) are not affected by dolt fetch directly, giving you control over when and how you integrate changes.
HISTORY
Dolt was created by DoltHub, Inc. with the goal of bringing Git-like version control semantics to SQL databases. The project started in 2018, building upon the Noms data format. As a core distributed version control operation, dolt fetch was fundamental from early stages, mimicking its Git counterpart to enable collaborative database development where users can synchronize their database state with remote repositories. It reflects Dolt's commitment to providing a familiar command-line experience for users accustomed to Git.
SEE ALSO
dolt-pull(1), dolt-clone(1), dolt-remote(1), dolt-branch(1), dolt-merge(1), git-fetch(1) (conceptual parallel)