Cheat Sheet

This cheat sheet briefly summarizes the main version-control features of Doltgres with simple examples.

Click links in the comments section to read docs for the feature.

Setup and init

SQLComments

CREATE DATABASE mydb;

Creates a new Dolt database

CALL DOLT_CLONE('post-no-preference/options');

Stage and snapshot

SQLComments

CALL DOLT_ADD('myTable');

CALL DOLT_RESET();

CALL DOLT_RESET('--hard');

CALL DOLT_COMMIT('-m', 'a commit');

CALL DOLT_COMMIT('-Am', 'a commit');

Branch and merge

SQLComments

SELECT * FROM dolt_branches;

CALL DOLT_BRANCH('myBranch');

CALL DOLT_CHECKOUT('myBranch');

CALL DOLT_CHECKOUT('-b', 'myBranch');

CALL DOLT_MERGE('myBranch');

Diffing

SQLComments

SELECT * FROM dolt_diff('HEAD', 'WORKING', 'mytable');

SELECT * FROM dolt_diff_stat('HEAD', 'WORKING', 'mytable');

SELECT * FROM dolt_diff('HEAD~', 'HEAD', 'mytable');

SELECT * FROM dolt_diff('HEAD', 'STAGED', 'mytable');

SELECT * FROM dolt_diff('branchA', 'branchB', 'mytable');

Status and logs

SQLComments

SELECT * FROM dolt_status;

SELECT active_branch();

SELECT * FROM dolt_log;

SELECT * FROM dolt_log('myBranch');

SELECT * FROM dolt_log('branchB..branchA');

History

SQLComments

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

SQLComments

CALL DOLT_REMOTE('add', 'myRemote', 'myOrg/myRepo');

SELECT * FROM dolt_remotes;

CALL DOLT_FETCH();

CALL DOLT_PULL();

CALL DOLT_PUSH('origin', 'myBranch');

CALL DOLT_PUSH();

Advanced use cases

SQLComments

SELECT HASHOF('main');

SELECT * from dolt_blame_mytable;

SELECT * FROM dolt_diff('branch1...branch2');

CALL DOLT_REVERT('gtfv1qhr5le61njimcbses9oom0de41e');

SELECT * FROM DOLT_PATCH('main', 'WORKING');

SELECT * FROM dolt_conflicts;

SELECT * FROM [dolt_conflicts_mytable];

CALL DOLT_CONFLICTS_RESOLVE('--theirs', 'mytable');

CALL DOLT_TAG('tag1', 'myBranch');

CALL DOLT_CHERRY_PICK('qj6ouhjvtrnp1rgbvajaohmthoru2772');

SELECT * FROM dolt_schema_diff('main', 'branch1', 'mytable');

CALL DOLT_VERIFY_CONSTRAINTS();

CALL DOLT_GC();

CALL DOLT_REBASE('--interactive', 'main');

SELECT * FROM dolt_reflog('mybranch');

SELECT * FROM dolt_commit_ancestors where commit_hash = HASHOF('main');

SELECT DOLT_MERGE_BASE('main', 'feature');

SELECT * FROM dolt_commits;

INSERT INTO dolt_ignore VALUES ("generated_*", true);

Last updated