dolt-checkout
Switch between dolt branches or commits
TLDR
Switch to a branch
Revert unstaged changes to a table
Create new branch and switch to it
Create new branch based on a specified commit and switch to it
SYNOPSIS
dolt checkout [ -b The dolt checkout command allows you to switch between different branches and commits within a Dolt repository. It's analogous to git checkout, but operates on Dolt's version-controlled database. You can use it to examine the state of the database at a particular point in history, create new branches to work on features, or revert to a previous version. dolt checkout modifies the .dolt directory, which stores metadata about the current branch, commit, and working set. It also updates the working set, which represents the current state of the database in your working directory. This command will checkout a branch, a commit, or a table. Checking out a commit directly (detached HEAD) will leave you in a state where any new commits you make will not be attached to any branch. Switch to the 'main' branch:
PARAMETERS
Create a new branch and switch to it.
--force
Forces a checkout even if the working set has uncommitted changes. Use with caution, as this can lead to data loss.
--detach
Check out a commit in 'detached HEAD' state.
The name of the branch to switch to.
The commit hash to checkout.
The name of the table to checkout. The table name must be qualified by branch or commit name (branch/tablename or commit/tablename)
DESCRIPTION
CAVEATS
You'll need to create a new branch to save your changes. Using --force can result in lost work if you have uncommitted changes. When you checkout a single table, it is copied into your working set. Subsequent reads from that table use the version of the table that was copied.
This continues until the working set is explicitly updated by committing or resetting. In these cases, the table version specified by branch or commit is used to update the working set.EXAMPLES
dolt checkout main
Create a new branch named 'feature/new-feature' and switch to it:
dolt checkout -b feature/new-feature
Check out a specific commit:
dolt checkout abc123def456
Check out table 'mytable' on the branch 'develop':
dolt checkout develop/mytableSEE ALSO