Skip to content

Instantly share code, notes, and snippets.

@dleve123
Created August 11, 2017 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dleve123/a1f1dffb7e0677ff2710f39d40883470 to your computer and use it in GitHub Desktop.
Save dleve123/a1f1dffb7e0677ff2710f39d40883470 to your computer and use it in GitHub Desktop.
Commit Counts
# USAGE: run from directory that contains Git directories to iterate over
summary() {
for directory in $( ls -d */ ); do
cd $directory
if [ -d ".git" ]; then
git pull > /dev/null 2>&1
echo $directory,`commit_count`
fi
cd ..
done
}
commit_count() {
git log --since="2 weeks ago" |
grep "Author: " |
wc -l |
sed -e 's/^[ \t]*//'
}
total_count() {
count=$(summary | cut -d , -f 2 | paste -sd+ - | bc)
echo "total commit count: $count"
}
summary
total_count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment