Created
October 26, 2013 14:25
-
-
Save marsam/7170029 to your computer and use it in GitHub Desktop.
git stats
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 | |
| # | |
| # Usage: | |
| # git stats --author mario | |
| # git stats --author pepe@lucho.org --since yesterday | |
| git_statistics(){ | |
| git log --shortstat --oneline $@ | | |
| grep -E "fil(e|es) changed" | | |
| awk ' | |
| function cyan(string){ | |
| return sprintf("\033[36m%s\033[0m", string) | |
| } | |
| function red(string){ | |
| return sprintf("\033[31m%s\033[0m", string) | |
| } | |
| function green(string){ | |
| return sprintf("\033[32m%s\033[0m", string) | |
| } | |
| BEGIN { files=0; insertions=0; deletions=0 } | |
| { files+=$1; insertions+=$4; deletions+=$6 } | |
| END { printf("%s files changed, %s insertions, %s deletions\n", cyan(files), green(insertions), red(deletions))}' | |
| } | |
| git_statistics $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment