Created
June 25, 2019 17:34
-
-
Save keeferrourke/15c304a36e4ec09b44e08821a102c696 to your computer and use it in GitHub Desktop.
Pretty print total added, removed, and contrib lines of code in a git repo for a user.
This file contains 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
#!/usr/bin/env bash | |
# git-loccount.sh | |
# Pretty prints the total added, removed, and contributed lines of code for a given user | |
# in a git repository. | |
# | |
# Arguments: | |
# $1 - username | |
# $2 - directory to check | |
if ! [ -z "$2" ]; then cd "$2"; fi | |
git log --author="$1" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment