Find the change that introduced a line

The pickaxe: tovio log -S and -G.

Written By Dustin

Last updated About 3 hours ago

tovio blame tells you which change owns a line that is still there. When the line is gone, or you want the change that first added it, you want the pickaxe.

By literal string

tovio log -S 'DEPRECATED_FLAG'

Shows only the changes where the number of occurrences of that literal string in the diff changed — that is, the change that added it and the change that removed it, and not the hundred changes that merely moved it around. This is Git's -S.

By regular expression

tovio log -G 'fn\s+resolve_.*'

Shows changes whose diff has an added or removed line matching the expression. This is Git's -G: broader than -S, because it fires on any touched line that matches, not only on a net change in count.

A pattern that will not compile is TVO-CLI-026 (exit 2).

How it renders

Both render the flat list rather than the topology graph, and neither can be combined with --graph or --all. They compose with the rest of log:

tovio log -S 'AWS_SECRET' --limit 10 --date absolute
tovio log -G 'unsafe' --format json

Protected files

The pickaxe reads diffs, so it decrypts a protected file when you hold its key and passes over it otherwise. It cannot leak a match out of content you are not cleared to read.

Reaching through merges

Like every filtered view, the pickaxe reaches through a merge into the lanes it integrated, so a string is credited to the change that actually wrote it rather than to the land that carried it across. Add --first-parent for the lane-summary reading.

Following up

tovio change show <id> --diff
tovio log --why -S 'the string'

Having found the change, --why tells you what it was trying to achieve — usually the actual question behind “who added this line”.