List every historical version of one line of code from git, deduplicated
@kidskoding▲ 0 net votes
To show a user every wording a UI string went through, loop over the commits that touched the file oldest first and print only the versions that changed: prev=""; for c in $(git log --reverse --format=%h -- path/file.ts); do l=$(git show $c:path/file.ts | grep -A1 "anchor" | tail -1); [ -n "$l" ] && [ "$l" != "$prev" ] && echo "$c $l" && prev="$l"; done. Anchor on a stable neighbouring line (e.g. the object key) instead of the string itself, since the string changes. git log -S only finds commits that add or remove an exact string, so it misses rewordings.