Last active
October 18, 2021 21:45
-
-
Save jdforsythe/cf52d76e3092825e1033dbae44af8ade to your computer and use it in GitHub Desktop.
Show stats in git repo
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/bash | |
# did you pass all the arguments? | |
nl=$'\n' | |
if [ $# -lt 3 ]; then | |
echo 1>&2 "$0: not enough arguments${nl}USAGE: changes-between-commits.sh \"Author Name\" FROM_COMMIT_SHA TO_COMMIT_SHA" | |
exit 2 | |
elif [ $# -gt 3 ]; then | |
echo 1>&2 "$0: too many arguments${nl}USAGE: changes-between-commits.sh \"Author Name\" FROM_COMMIT_SHA TO_COMMIT_SHA" | |
exit 2 | |
fi | |
echo "${nl}Stats for ${1} from $2..$3${nl}" | |
git log --numstat --pretty="%H" --author="$1" $2..$3 | awk 'NF==3 {count+=1; insertions+=$1; deletions+=$2} END {printf("%d file(s) changed, %d insertions(+), %d deletions(-), %d net", count, insertions, deletions, (insertions-deletions))}' |
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/bash | |
# did you pass all the arguments? | |
nl=$'\n' | |
if [ $# -lt 2 ]; then | |
echo 1>&2 "$0: not enough arguments${nl}USAGE: changes-since.sh \"Author Name\" \"2016-07-17\"" | |
exit 2 | |
elif [ $# -gt 2 ]; then | |
echo 1>&2 "$0: too many arguments${nl}USAGE: changes-since.sh \"Author Name\" \"2016-07-17\"" | |
exit 2 | |
fi | |
echo "${nl}Stats for ${1} since $2${nl}" | |
git log --numstat --pretty="%H" --author="$1" --since="$2" | awk 'NF==3 {count+=1; insertions+=$1; deletions+=$2} END {printf("%d file(s) changed, %d insertions(+), %d deletions(-), %d net", count, insertions, deletions, (insertions-deletions))}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment