LinuxCommandLibrary

dolt-blame

Show who last modified each database row

TLDR

Display the latest commit for each row of a table

$ dolt blame [table]
copy

Display the latest commits for each row of a table when the specified commit was made
$ dolt blame [commit] [table]
copy

Display help
$ dolt blame --help
copy

SYNOPSIS

dolt blame [options] [commit] [--] path

PARAMETERS

-b rev, --bit=rev
    Use rev (commit-ish) as starting point for blame.

-L start,end, --line-range=L
    Annotate only lines from start to end (supports regex).

-C, --contents-from=rev
    Blame using contents from rev instead of working tree.

-l, --shownames
    Show full commit names (SHA-1).

-t, --porcelain
    Machine-readable porcelain output format.

--porcelain=v2
    Version 2 porcelain format.

-p, --porcelain
    Show unified diff with commit (alias for -p).

-w
    Ignore whitespace changes.

-M
    Detect lines moved/copied within file.

DESCRIPTION

The dolt blame command displays line-by-line annotation for files in a Dolt repository, showing the revision, author, and timestamp of the last modification for each line. Similar to git blame, it helps track code or data changes over time in Dolt's Git-like version control for databases.

Dolt is a SQL database with branching, merging, and history tracking. dolt blame operates on tracked files within a Dolt working directory, revealing who changed what and when. It's invaluable for debugging, auditing SQL scripts, schema diffs, or data modifications.

Output format includes commit hash, author name/email, date, and the line content. Use options to filter by line range, specify revisions, or alter output style. Requires a Dolt repo initialized with dolt init.

CAVEATS

Requires Dolt repository (dolt init). Only works on tracked files. Performance degrades on large histories or files. Dolt-specific; not compatible with Git repos.

EXAMPLE USAGE

dolt blame main.sql
Annotates all lines in main.sql from main branch.

dolt blame -L 10,20 HEAD -- schema.sql
Blames lines 10-20 in schema.sql at HEAD.

OUTPUT SAMPLE

^abc1234 (Author <email> 2023-01-01 10:00:00 +0000 1) SELECT * FROM users;
^def5678 (Jane Doe <jane@example.com> 2023-02-01 12:00:00 +0000 2) WHERE id = 1;

HISTORY

Introduced in early Dolt versions (~2020) by DoltHub team to mirror git blame. Evolved with Git compatibility; key for data versioning workflows. Actively maintained as Dolt reaches v1.x milestones.

SEE ALSO

git-blame(1), dolt-log(1), dolt-diff(1)

Copied to clipboard