Skip to content

Instantly share code, notes, and snippets.

@waffle2k
Created May 27, 2014 18:32
Show Gist options
  • Save waffle2k/4ed9a1e707cc408e05b6 to your computer and use it in GitHub Desktop.
Save waffle2k/4ed9a1e707cc408e05b6 to your computer and use it in GitHub Desktop.
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