Skip to content

Instantly share code, notes, and snippets.

@trotzig
Last active Nov 18, 2016
Embed
What would you like to do?
Counting commits
#!/bin/bash
# Run the script like this:
# > bash count_commits.sh <name>
# where name is a uniquely identifying string for a contributor, e.g. "Lencioni"
repos=( "causes" "brigade" "devscripts" "cuisine" "scss-lint"
"brigade-cap-tasks" "overcommit" "mock_redis" "sass-enhance"
"eslint-config-brigade" "react-waypoint" "haml-lint" "async_observer" "bender"
"react-simple-pie-chart" "tech-interview" "url-sweatshirt" "db-query-matchers"
"code-of-conduct" "traffic-light" "dockerfiles" "bender" "finagle-services"
"bli" "foghorn" "spark-instrumentation" "pluribus-debugger" "thrift-shop"
"pluribus" "brigade-cap-tasks" "tech-interview" "brigade-webview-android"
"office-dashboard" "tabula" "daily-report" "speech-watch" "verifier"
"brigade-maps")
total_count=0
for repo in "${repos[@]}"
do
if [ ! -d "$repo" ]; then
git clone git@github.com:brigade/${repo}.git
fi
cd $repo
count=$(git shortlog -s -n | grep $1 | cut -f1 | awk '{s+=$1} END {print s}')
if [ -n "$count" ]; then
total_count=$( expr $total_count + $count )
echo "${repo}: ${count}"
else
echo "${repo}: 0"
fi
cd ..
done
echo "-----------------------------"
echo "TOTAL COMMITS: $total_count"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment