Last active
August 29, 2015 14:20
-
-
Save davidrapson/c23c6f73b2b9fc398f44 to your computer and use it in GitHub Desktop.
List git changes by filetype pattern for an author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| author=$1; shift; | |
| patterns=( "$@" ); | |
| function get_commits() { | |
| git log --author=$1 --pretty=tformat: --numstat \ | |
| | grep $2 \ | |
| | awk '{ add += $1; subs += $2; loc += $1 - $2 } | |
| END { | |
| printf "+%s, -%s, %s total (%s:1 +/- ratio)\n", | |
| add, subs, loc, sprintf("%.2f", add / subs) | |
| }' | |
| } | |
| for i in "${patterns[@]}" | |
| do | |
| echo "\nChanges for pattern \"$i\""; | |
| get_commits $author $i; | |
| done | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lists how many changes the author
davidhas made where the file name ends with.scalaAlso allows passing multiple patterns, where first argument is the author name and subsequent arguments are patterns to match against. Useful for comparing across languages, for example: