Created
July 27, 2014 07:45
-
-
Save neilvallon/6a1535640806cd85f041 to your computer and use it in GitHub Desktop.
Count total line changes in a git repository.
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
#!/usr/bin/env ruby | |
log = `git log --oneline --shortstat` | |
puts log | |
i = 0 | |
d = 0 | |
log.each_line { |l| | |
ii = /([0-9]+) insertion/.match(l) | |
i += ii[1].to_i if ii | |
dd = /([0-9]+) deletion/.match(l) | |
d += dd[1].to_i if dd | |
} | |
puts "\nTotal: #{i} insertions, #{d} deletions" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment