Created
April 24, 2012 20:35
-
-
Save mgilliam/2483507 to your computer and use it in GitHub Desktop.
Get commits by month for a given time range and output to tab-delimited text.
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 | |
stats_file="${HOME}/Dropbox/projects/loc/stats.txt" | |
start_date='2011-04-01' | |
end_date='2012-04-01' | |
sep='\t' | |
echo -en ${sep} > "${stats_file}" | |
months=(Apr May Jun Jul Aug Sep Oct Nov Dec Jan Feb Mar) | |
for (( i=0; i<${#months[@]}-1; i++ )) ; do | |
echo -en "${months[$i]}${sep}" >> "${stats_file}" | |
done | |
echo "${months[${#months[@]}-1]}" >> "${stats_file}" | |
for repo in $(ls -d */) ; do | |
cd "${repo}" | |
echo -n $(echo "${repo}" | sed 's/\/*$//') >> "${stats_file}" | |
echo -en "${sep}" >> "${stats_file}" | |
for (( i=0; i<${#months[@]}-1; i++ )) ; do | |
echo -n $(git shortlog -n --format='%ad %s' \ | |
--since=${start_date} --until=${end_date} | \ | |
grep "${months[$i]}" | wc -l) >> "${stats_file}" | |
echo -en "${sep}" >> "${stats_file}" | |
done | |
echo $(git shortlog -n --format='%ad %s' \ | |
--since=${start_date} --until=${end_date} | \ | |
grep "${months[${#months[@]}-1]}" | wc -l) >> "${stats_file}" | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment