Dolt: The Git‑Powered Database with 23K Stars—Commit Directly to Tables
Dolt is an open‑source, MySQL‑compatible database that embeds Git’s version‑control model, letting you commit, branch, merge and audit table data just like source code, with simple installation, CLI commands, SQL stored procedures, GitHub remote support, and CI integration.
Project Overview
Dolt (Apache‑2.0) combines MySQL compatibility with Git‑style version control. The binary is a single ~103 MB file with zero runtime dependencies and runs on macOS, Linux, Windows, and Docker.
Installation
# macOS
brew install dolt
# Linux
sudo bash -c 'curl -L https://github.com/dolthub/dolt/releases/latest/download/install.sh | bash'
# Windows (MSI) or Chocolatey
choco install dolt
# Docker
docker run -p 3306:3306 dolthub/dolt-sql-server:latestVerify with dolt version.
Git‑like CLI
The dolt command mirrors Git workflow: dolt init – create a repository dolt add – stage changes dolt commit – record a version dolt log – view commit history dolt diff – row‑level differences dolt branch, dolt merge, dolt clone, dolt push,
dolt pull dolt blame– identify the author of a row change
SQL Stored Procedures
Each CLI operation has a corresponding stored procedure, enabling version‑control actions from SQL:
CALL dolt_add();
CALL dolt_commit('-am', 'message');
CALL dolt_checkout('-b', 'new_branch');
CALL dolt_merge('new_branch');
CALL dolt_reset('--hard');Schema Versioning and Conflict Resolution
Schema changes are performed on a branch, then merged. Example:
CALL dolt_checkout('-b', 'add_start_date_column');
ALTER TABLE employees ADD COLUMN start_date DATE;
UPDATE employees SET start_date='2018-09-08';
CALL dolt_commit('-am', 'Added start_date column to employees');
CALL dolt_checkout('main');
CALL dolt_merge('add_start_date_column');If two branches modify the same row/column, Dolt reports a merge conflict identical to git merge, showing table, row, and conflicting values for manual resolution.
Data Lineage and Auditing
Dolt stores a full snapshot of every row for each commit in system tables: dolt_history_<tablename> – row snapshot per commit dolt_diff_<tablename> – changes between commits dolt_log – commit hash, author, timestamp, message
Example queries:
SELECT * FROM dolt_log;
SELECT * FROM dolt_diff_employees;
SELECT * FROM dolt_history_employees;GitHub Remote Integration
Since v1.81.10, Dolt can treat a GitHub repository as a remote database using the custom ref refs/dolt/data. Pushing with dolt push origin main stores the database alongside code without inflating repository size. Cloning restores the database instantly.
CI/CD Example (GitHub Actions)
- name: Clone Dolt database from GitHub remote
run: |
dolt clone "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" db
- name: Basic sanity checks
run: |
cd db
dolt sql -q "SELECT count(*) AS commits FROM dolt_log;"This workflow validates that the database can be cloned, the schema is correct, and commit history is intact on every push.
Doltgres – PostgreSQL Compatibility
Doltgres provides a PostgreSQL‑compatible server. Installation:
sudo bash -c 'curl -L https://github.com/dolthub/doltgresql/releases/latest/download/install.sh | bash'Start with doltgres and connect via psql. The same stored procedures ( dolt_add, dolt_commit, etc.) are available. The beta release reports write latency roughly five times higher than native PostgreSQL; read performance varies by query type.
Performance and Adoption Considerations
Official benchmarks cite a write latency increase of about 1.1× compared with native MySQL. Dolt is best suited for read‑heavy, frequently changing data that requires auditability and collaborative editing. Pure write‑intensive workloads without version‑control needs may find the overhead unnecessary.
Repository
https://github.com/dolthub/dolt
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
