Skip to content

Instantly share code, notes, and snippets.

@yongjhih
Last active June 16, 2022 05:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yongjhih/0d168ea4472fbbe13a8df9bb5f6faa8f to your computer and use it in GitHub Desktop.
Save yongjhih/0d168ea4472fbbe13a8df9bb5f6faa8f to your computer and use it in GitHub Desktop.
#!/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