Created
February 16, 2011 19:04
-
-
Save coreyhaines/829932 to your computer and use it in GitHub Desktop.
Bash script to generate churn counts in git repo
This file contains 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
churn number and file name | |
git log --all -M -C --name-only | grep -E '^(app|lib)/' | sort | uniq -c | sort | awk 'BEGIN {print "count,file"} {print $1 "," $2}' | |
churn number and file name w/ limiting to last n commits | |
git log --all -n 5000 -M -C --name-only | grep -E '^spec/models' | sort | uniq -c | sort | awk 'BEGIN {print "count,file"} {print $1 "," $2}' | |
graph of churn number and frequency | |
git log --all -M -C --name-only | grep -E '^(app|lib)/' | sort | uniq -c | sort | awk '{print $1}' | uniq -c | sort | awk 'BEGIN { print "frequency,churn_count"} { print $1,$2}' | |
Great, this helped me a lot. Thanks!
If you add -n
to the final sort
it will sort numerically instead of alphabetically
If you remove -all
it allows specifying an SHA1 in the log as churn up to that SHA1.
I just found https://github.com/AnAppAMonth/git-churn, which is a python solution giving a more detailed interpretation of churn (additions, subtractions).
Solutions that I've found online looked at changes to files irrespective whether these are new changes or edits to existing lines of code. Hence I made this solution: https://github.com/flacle/truegitcodechurn/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This might need some more work, haven't done anything with it for awhile, but this tracks files, classes, and methods for a ruby project
https://github.com/danmayer/churn