Cheat Sheet
This cheat sheet briefly summarizes the main version-control features of Dolt with simple examples. Most commands can be executed on the command line or in a SQL session. Most Dolt commands take the same options as Git commands.
Click links in the comments section to read docs for the feature.
Setup and init
CREATE DATABASE mydb;
dolt init
Creates a new Dolt database
CALL DOLT_CLONE('post-no-preference/options');
dolt clone post-no-preference/options
Stage and snapshot
Branch and merge
CALL DOLT_CHECKOUT('-b', 'myBranch');
dolt checkout -b myBranch
Diffing
SELECT * FROM dolt_diff('HEAD', 'WORKING', 'mytable');
dolt diff mytable
SELECT * FROM dolt_diff_stat('HEAD', 'WORKING', 'mytable');
dolt diff --stat mytable
SELECT * FROM dolt_diff('HEAD~', 'HEAD', 'mytable');
dolt diff HEAD~ HEAD mytable
SELECT * FROM dolt_diff('HEAD', 'STAGED', 'mytable');
dolt diff --cached mytable
SELECT * FROM dolt_diff('branchA', 'branchB', 'mytable');
dolt diff branchA branchB mytable
Status and logs
SELECT * FROM dolt_log('branchB..branchA');
dolt log branchB..branchA
History
History querying is specific to the SQL server and has no command line equivalent.
SELECT * FROM mytable AS OF 'HEAD~3';
USE mydb/HEAD~3;
SELECT * FROM dolt_history_mytable;
SELECT committer FROM dolt_history_mytable where id = 1 order by commit_date LIMIT 1;
Working with remotes
CALL DOLT_REMOTE('add', 'myRemote', 'myOrg/myRepo');
dolt remote add myRemote/myRepo
CALL DOLT_PUSH('origin', 'myBranch');
dolt push origin myBranch
Advanced use cases
CALL DOLT_REVERT('gtfv1qhr5le61njimcbses9oom0de41e');
dolt revert gtfv1qhr5le61njimcbses9oom0de41e
SELECT * FROM DOLT_PATCH('main', 'WORKING');
dolt patch main
SELECT * FROM [dolt_conflicts_mytable];
dolt conflicts cat mytable
CALL DOLT_CONFLICTS_RESOLVE('--theirs', 'mytable');
dolt conflicts resolve --theirs mytable
CALL DOLT_CHERRY_PICK('qj6ouhjvtrnp1rgbvajaohmthoru2772');
dolt cherry-pick qj6ouhjvtrnp1rgbvajaohmthoru2772
SELECT * FROM dolt_schema_diff('main', 'branch1', 'mytable');
dolt diff --schema main branch1
CALL DOLT_VERIFY_CONSTRAINTS();
dolt verify-constraints
CALL DOLT_REBASE('--interactive', 'main');
dolt rebase --interactive main
SELECT * FROM dolt_reflog('mybranch');
dolt reflog mybranch
SELECT * FROM dolt_commit_ancestors where commit_hash = HASHOF('main');
No equivalent
SELECT DOLT_MERGE_BASE('main', 'feature');
dolt merge-base main feature
INSERT INTO dolt_ignore VALUES ("generated_*", true);
No equivalent
Last updated
Was this helpful?