grit blame [--rev <commit>] [-L START,END] <file>
Description
Walks history for one file and prints each line with the commit that last modified it, the author, when that commit was made, and the line number in the blamed revision.
Options
| Option | Description |
|---|---|
--rev <commit> |
Blame the file as it existed at this revision (branch, tag, oid, HEAD~N, …). Defaults to HEAD. |
-L START,END |
Limit output to an inclusive 1-based line range in the final file. |
--lines |
Same as -L (long form). |
JSON output
Pass --json for stable, scripting-friendly output:
| Field | Type | Meaning |
|---|---|---|
file |
string | Repository-relative path that was blamed. |
rev |
string | Full commit oid of the start revision. |
lines |
array | One record per line (after any -L filter), in final-line order. |
lines[].commit |
string | Full commit oid for the line. |
lines[].original_line |
number | 1-based line number in the originating commit. |
lines[].final_line |
number | 1-based line number in the blamed revision. |
lines[].content |
string | Line text. |
commits |
object | Map of commit oid → metadata for every line. |
commits.<oid>.author |
string | Author identity line. |
commits.<oid>.author_time |
number | Author time (Unix seconds). |
commits.<oid>.summary |
string | First line of the commit message. |
Markdown output
Pass --markdown for a table suited to agents: columns are final line, short commit, author, date, original line, and content.