Skip to content

Instantly share code, notes, and snippets.

@EvanLovely
Created March 27, 2015 21:54
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EvanLovely/a85aec1c1402b08d24c2 to your computer and use it in GitHub Desktop.
Save EvanLovely/a85aec1c1402b08d24c2 to your computer and use it in GitHub Desktop.
Show a list of the top authors of all the files in a folder, according to `git blame`.

Show a list of the top authors of all the files in a folder, according to git blame.

Use

bash git-top-authors.sh path/to/folder

Output

593 Author 1
352 Author 2
168 Author 3
 76 Author 4
#!/bin/bash
DIR="$1"
IFS=$'\n'
cd "$DIR"
LIST=""
for i in $(find . -iname "*.scss"); do
LIST="`git blame --line-porcelain "$i" | grep 'author ' | sed "s,author,," | tr -d ' '`
$LIST"
done
echo "$LIST" | sort | uniq -ic | sort -nr
unset IFS
@RedGuy12
Copy link

How can I make this go for all files, not just scss files?

@Arkinator
Copy link

just leave out the filter criterion in the find command (eg "find .") @RedGuy12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment