Skip to content

Instantly share code, notes, and snippets.

@acg
Last active May 18, 2024 17:33
Show Gist options
  • Save acg/41e147c15e36c6db87db5bd286c03ba3 to your computer and use it in GitHub Desktop.
Save acg/41e147c15e36c6db87db5bd286c03ba3 to your computer and use it in GitHub Desktop.
Fast filewise git blame.
#!/bin/sh
TZ=UTC git log --name-status --date=iso-strict-local --pretty="%ad%x09%ae" "$@" |
perl -F'/\t/' -lane '
if (/^[ACDMRTUXB]/) {
$path = @F>2 ? $F[2] : $F[1];
print "$date\t$email\t$path" if -e "$path";
} elsif (@F) {
($date, $email)=@F;
}
' |
sort -k3,3 -k1,1r |
uniq -f2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment