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
CREATE DATABASE mydb;
Creates a new Dolt database
SELECT DOLT_CLONE('post-no-preference/options');
Stage and snapshot
SELECT DOLT_ADD('myTable');
SELECT DOLT_RESET();
SELECT DOLT_RESET('--hard');
SELECT DOLT_COMMIT('-m', 'a commit');
SELECT DOLT_COMMIT('-Am', 'a commit');
Branch and merge
SELECT * FROM dolt_branches;
SELECT DOLT_BRANCH('myBranch');
SELECT DOLT_CHECKOUT('myBranch');
SELECT DOLT_CHECKOUT('-b', 'myBranch');
SELECT DOLT_MERGE('myBranch');
Diffing
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
SELECT * FROM dolt_status;
SELECT active_branch();
SELECT * FROM dolt_log;
SELECT * FROM dolt_log('myBranch');
SELECT * FROM dolt_log('branchB..branchA');
History
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
SELECT DOLT_REMOTE('add', 'myRemote', 'myOrg/myRepo');
SELECT * FROM dolt_remotes;
SELECT DOLT_FETCH();
SELECT DOLT_PULL();
SELECT DOLT_PUSH('origin', 'myBranch');
SELECT DOLT_PUSH();
Advanced use cases
SELECT HASHOF('main');
SELECT * from dolt_blame_mytable;
SELECT * FROM dolt_diff('branch1...branch2');
SELECT DOLT_REVERT('gtfv1qhr5le61njimcbses9oom0de41e');
SELECT * FROM DOLT_PATCH('main', 'WORKING');
SELECT * FROM dolt_conflicts;
SELECT * FROM [dolt_conflicts_mytable];
SELECT DOLT_CONFLICTS_RESOLVE('--theirs', 'mytable');
SELECT DOLT_TAG('tag1', 'myBranch');
SELECT DOLT_CHERRY_PICK('qj6ouhjvtrnp1rgbvajaohmthoru2772');
SELECT * FROM dolt_schema_diff('main', 'branch1', 'mytable');
SELECT DOLT_VERIFY_CONSTRAINTS();
SELECT DOLT_GC();
SELECT 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