dolt-checkout

switch branches or restore working tables

TLDR

Switch to branch
$ dolt checkout [branch_name]
Create and switch to new branch
$ dolt checkout -b [new_branch]
Restore a table to its HEAD version, discarding changes
$ dolt checkout [table_name]
Restore a table as it was at a given commit
$ dolt checkout [commit_hash] -- [table_name]
Create a branch tracking a remote branch
$ dolt checkout --track [origin]/[branch_name]
Discard local changes and force the switch
$ dolt checkout --force [branch_name]

SYNOPSIS

dolt checkout branchdolt checkout table...dolt checkout commit [--] table...dolt checkout -b new-branch [start-point]dolt checkout --track remote/branch

DESCRIPTION

dolt checkout switches branches or restores tables in the working set. Like `git checkout` it serves several purposes: moving between branches, creating branches, and discarding uncommitted changes.Given a branch name, it points the working database at that branch. With -b it creates the branch first. Given one or more table names, it restores those tables to match HEAD, throwing away uncommitted changes; adding a commit before `--` restores them as of that commit instead.Dolt's branches are cheap, since they are pointers into the same content-addressed storage, so branching per feature, per import, or per experiment is a normal workflow on data as well as schema.

PARAMETERS

-b new-branch [start-point]

Create a branch named new-branch starting at start-point (defaults to HEAD) and switch to it.
-B new-branch [start-point]
Like -b, but forcibly resets the branch to start-point if it already exists.
-f, --force
Wipe out the current changes and check out the new branch anyway.
-t, --track
When creating a branch, set up upstream tracking configuration.
--overwrite-ignore
Silently overwrite ignored tables when switching branches.
--no-overwrite-ignore
Abort the checkout if ignored tables would be overwritten.

INSTALL

sudo pacman -S dolt
brew install dolt
nix profile install nixpkgs#dolt

CAVEATS

Restoring a table discards its uncommitted changes with no way back: there is no reflog for the working set. Unlike Git, dolt checkout does not accept a bare commit hash to enter a detached HEAD; use `dolt checkout -b <branch> <commit>` to work from an old commit. When a `dolt sql-server` is running against the database, the CLI shares the server's session state, so checkouts made from the shell are visible to connected clients.

HISTORY

dolt checkout mirrors git checkout for Dolt's versioned database, giving Git users a familiar way to move between branches of data. Dolt has since also grown Git's newer split of the command into `dolt branch` for branch management and `dolt reset`/`dolt revert` for undoing work, but `checkout` remains the everyday entry point.

SEE ALSO

dolt(1), dolt-branch(1), dolt-merge(1), git-checkout(1)

RESOURCES

Source code · Documentation