Skip to content

Instantly share code, notes, and snippets.

@yongjhih
Last active Jun 16, 2022
Embed
What would you like to do?
#!/usr/bin/env bash
while read f; do
# Max commits
# owner="$(git shortlog -n -s "$f" | head -1 | cut -f 2)"
# Max lines
#owner="$(git blame -c "$f" | awk '{print $3}' | sort | uniq -c | sort -r | head -1 | awk '{print $2}')"
owner="$(git blame --line-porcelain "$f" | grep '^author ' | sed 's|^author ||' | sort | uniq -c | sort -r | head -1 | awk '!($1="")' | sed 's|^ *||g' | sed 's| *$||g')"
echo -e "$f\t$owner"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment