The Dolt log is a way to visualize the Dolt commit graph in an intuitive way. When viewing the log, you are seeing a topologically sorted commit order that led to the commit you have checked out. The log is an audit trail of commits.
In Dolt, you can visualize the log of a database, a table, a row, or even a cell.
Log is usually filtered by branch. Any commits not reachable in the graph from the current commit will be omitted from the log.
How to use logs
Logs are useful in reverting the database to a previous state. You determine the state of the database you want via log and then use other Dolt commands to change the database to a different state.
Logs are useful when trying to track down why the database is in a particular state. You use log to find the commits in question and usually follow up with diffs (i.e. differences) between two commits you found in the log.
Logs are useful in audit. If you would like to ensure a particular value in the database has not changed since the last time you read it, log is useful in verifying this.
Difference between Git log and Dolt log
Conceptually and practically log on the command line is very similar between Git and Dolt. A table is akin to a file in Git.
Dolt has additional log functionality beyond Git. You can produce a log of any cell (i.e. row, column pair) in the database using a SQL query against the dolt_history_<tablename> system table.
Example
Commit Log
%doltlogcommitcffu3k56rtv6cf28370buivf33bb2mvrAuthor:TimSehn<tim@dolthub.com>Date:FriDec0309:49:29-08002021Thisisacommitcommitt5d5inj4bpc1fltrdm9uoscjdsgebaihAuthor:TimSehn<tim@dolthub.com>Date:FriDec0309:49:10-08002021Initializedatarepositorydocs $ doltsql-q"select * from dolt_log"+----------------------------------+-----------+------------------+-----------------------------------+----------------------------+|commit_hash|committer|email|date|message|+----------------------------------+-----------+------------------+-----------------------------------+----------------------------+|u73s2mb1ho4mj1ldkof939vampo93bld|TimSehn|tim@dolthub.com|2021-12-0610:45:11.148-0800PST|Thisisacommit||bo318l76dq3bdvu1ie84d4nmv4hpi4km|TimSehn|tim@dolthub.com|2021-12-0216:55:00.101-0800PST|Thisisacommit||jcj6q9c9nsveh72eadsms9i9k9ii1e55|TimSehn|tim@dolthub.com|2021-12-0216:54:35.87-0800PST|Initializedatarepository|+----------------------------------+-----------+------------------+-----------------------------------+----------------------------+
Cell History
$ dolt sql -q "select * from dolt_history_employees where id=0 order by commit_date";
+------+-----------+------------+------------+----------------------------------+-----------+-------------------------+
| id | last_name | first_name | start_date | commit_hash | committer | commit_date |
+------+-----------+------------+------------+----------------------------------+-----------+-------------------------+
| 0 | Sehn | Tim | NULL | 13qfqa5rojq18j84d1n2htjkm6fletg4 | Tim Sehn | 2022-06-07 16:39:32.066 |
| 0 | Sehn | Timothy | NULL | uhkv57j4bp2v16vcnmev9lshgkqq8ppb | Tim Sehn | 2022-06-07 16:41:49.847 |
| 0 | Sehn | Tim | 2018-09-08 | pg3nfi0j1dpc5pf1rfgckpmlteaufdrt | Tim Sehn | 2022-06-07 16:44:37.513 |
| 0 | Sehn | Timothy | 2018-09-08 | vn9b0qcematsj2f6ka0hfoflhr5s6p0b | Tim Sehn | 2022-06-07 17:10:02.07 |
+------+-----------+------------+------------+----------------------------------+-----------+-------------------------+