Last active
November 18, 2016 07:59
-
-
Save trotzig/4ff381a0923362fd6083 to your computer and use it in GitHub Desktop.
Counting commits
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 | |
| # 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 [email protected]: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