Created
September 3, 2011 15:11
-
-
Save NilsHaldenwang/1191320 to your computer and use it in GitHub Desktop.
This script outputs the sum of the git changes you made today.
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 | |
changed_files = insertions = deletions = 0 | |
lines = `git log --since="0am" --stat` | |
lines.each_line do |line| | |
if line =~ /(\d+) files changed, (\d+) insertions\(\+\), (\d+) deletions\(-\)/ | |
changed_files += $1.to_i | |
insertions += $2.to_i | |
deletions += $3.to_i | |
end | |
end | |
branch = `git name-rev --name-only HEAD` | |
puts "Today you made the following changes on the branch '#{branch.chomp}':" | |
puts "#{changed_files} files changed, #{insertions} insertions(+), #{deletions} deletions(-)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment