Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Find out how much work you or your workmates have done
#!/usr/bin/perl
use strict;
my $author = `git config user.email`;
if ($ARGV[0] =~ /^\S+?\@\S+$/){
$author = shift;
}
my $since = join( " ", @ARGV );
$since = 'yeterday' if ( $since =~ /^\s*$/ );
chomp( $author );
die "No author set"
if $author =~ /^\s*$/;
my ($a,$d) = (0,0);
my @results = `git --no-pager log --pretty=oneline --shortstat --author $author --since '$since'`;
chomp for @results;
for (@results){
chomp;
if ( /(\d+) insertions/ ){
$a += $1;
}
if ( /(\d+) deletions/ ){
$d += $1;
}
}
printf "Deleted %s and inserted %s lines\n", $d, $a;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment