# author/commit counts

12 messages from 2006-12-23 to 2006-12-23. Participants: Randy Dunlap, Shawn Pearce, Randal L. Schwartz, Junio C Hamano, Linus Torvalds, Nicolas Pitre, Johannes Schindelin.
Thread: https://gitlist.dev/t/6084

## Randy Dunlap, 2006-12-23 02:10

Subject: author/commit counts
Message-ID: <20061222181030.d733deb3.rdunlap@xenotime.net>
URL: https://gitlist.dev/e/20061222181030.d733deb3.rdunlap%40xenotime.net

```
Hi,

Someone asked me a few days ago about their patches being merged yet
(e.g., how to see their commits in a git tree).
Someone else asked (in general) about commit or author counts.

I pointed the first person to "git log" and/or gitweb.
For the second, there are probably lots of scripts out there
but I didn't find them.  Where are they?

Is this useful?  or it needs fixing?
or you already have better solutions?

example:
git log v2.6.19.. | authorcount -m | less

# this is just the ones with >= 50 Author: lines

Al Viro : 213
Linus Torvalds : 94
Jiri Slaby : 90
Josef Sipek : 79
Gerrit Renker : 77
Adrian Bunk : 67
Andrew Morton : 59
Tejun Heo : 52
Mariusz Kozlowski : 52
Paul Mundt : 51
Ralf Baechle : 50
---

#! /usr/bin/perl
# Copyright (C) 2006, Randy Dunlap.

# read stdin, drop non-author: lines, count/sum/tally author: lines by
# each author after sanitizing author-name somewhat.
#
# optionally print out in author-name (-a) alpha order
# or in numeric/count (-n) order (low-to-high)
# or in numeric/count (-m) order (high-to-low) ("max" first)

# hash for author names:
my %authors;
my $auth;
my $sortby;

sub usage()
{
	print "usage: authorcount [-a | -n | -m] < git.log.lines\n";
	exit(1);
}

$sortby = $ARGV[0];
if (($sortby ne "") && ($sortby ne "-a") && ($sortby ne "-n") &&
    ($sortby ne "-m"))
{
	print "Invalid sort option: $sortby\n";
	usage();
}

READIN: while ($line = <STDIN>)
{
	chomp $line;
	next READIN if $line !~ /Author:/;

	$auth = $line;
	$auth =~ s/Author: //;
	$auth =~ s/<.*>//;

	$authors{$auth}++;

} # end READIN

sub byvalue
{
	$authors{$a} <=> $authors{$b};
}

# optionally sort by author name or author counts
# print out the tally array

if ($sortby eq "-a")
{
	foreach $auth (sort keys %authors)
	{
		print "$auth: $authors{$auth}\n";
	}
}
elsif ($sortby eq "-n")
{
	foreach $auth (sort byvalue keys %authors)
	{
		print "$auth: $authors{$auth}\n";
	}
}
elsif ($sortby eq "-m")
{
	foreach $auth (reverse sort byvalue keys %authors)
	{
		print "$auth: $authors{$auth}\n";
	}
}
else # no sort, just hash order
{
	while (($auth, $count) = each(%authors))
	{
		print "$auth: $count\n";
	}
}

```

## Shawn Pearce, 2006-12-23 02:37

Subject: Re: author/commit counts
Message-ID: <20061223023719.GA8734@spearce.org>
URL: https://gitlist.dev/e/20061223023719.GA8734%40spearce.org
In-Reply-To: <20061222181030.d733deb3.rdunlap@xenotime.net>

```
Randy Dunlap <rdunlap@xenotime.net> wrote:
> Someone asked me a few days ago about their patches being merged yet
> (e.g., how to see their commits in a git tree).
> Someone else asked (in general) about commit or author counts.

I often do `git log --author=Shawn next@{1}..next` to see what
commits of mine Junio has recently merged into git.git since my
last fetch.  Since I'm the only Shawn (with that spelling) that
contributes to git.git this works rather well to show my work.  ;-)
 
> I pointed the first person to "git log" and/or gitweb.
> For the second, there are probably lots of scripts out there
> but I didn't find them.  Where are they?

Here's another variant showing the top 20 committers to git.git,
no Perl involved:

  $ git log | grep ^Author | cut -d\< -f1 | sort \
  	| uniq -c | sort -n -r | head -20
  3728 Author: Junio C Hamano 
   842 Author: Linus Torvalds 
   250 Author: Johannes Schindelin 
   217 Author: Jakub Narebski 
   194 Author: Eric Wong 
   166 Author: Petr Baudis 
   150 Author: Paul Mackerras 
   147 Author: Kay Sievers 
    88 Author: Nicolas Pitre 
    77 Author: Rene Scharfe 
    67 Author: Shawn Pearce 
    57 Author: Martin Langhoff 
    53 Author: Fredrik Kuivinen 
    52 Author: Nick Hengeveld 
    52 Author: Matthias Urlichs 
    49 Author: Daniel Barkalow 
    47 Author: Ryan Anderson 
    46 Author: Shawn O. Pearce 
    45 Author: Sergey Vlasov 
    45 Author: Luben Tuikov 

The only issue I have with that is I seem to have two attributions
in git.git: 'Shawn Pearce' and 'Shawn O. Pearce'.  Technically I'm
in the top 10 by commit volume but its not immediately clear because
of the two attributions being used.  Really my only issue here is
why sometimes my middle initial gets used and other times it doesn't.

You can also see the very clear gap between Junio and the rest of the
world.  There's very little dispute about who really codes Git.  :-)

I'm personally suprised at Pasky's ranking: 166 commits!  I did
not realize he had contributed so frequently to git.git itself.

-- 
Shawn.

```

## Randal L. Schwartz, 2006-12-23 04:37

Subject: Re: author/commit counts
Message-ID: <86vek3p6s3.fsf@blue.stonehenge.com>
URL: https://gitlist.dev/e/86vek3p6s3.fsf%40blue.stonehenge.com
In-Reply-To: <20061222181030.d733deb3.rdunlap@xenotime.net>

```
>>>>> "Randy" == Randy Dunlap <rdunlap@xenotime.net> writes:

Randy> example:
Randy> git log v2.6.19.. | authorcount -m | less

Randy> # this is just the ones with >= 50 Author: lines

Randy> Al Viro : 213
Randy> Linus Torvalds : 94
Randy> Jiri Slaby : 90
Randy> Josef Sipek : 79
Randy> Gerrit Renker : 77
Randy> Adrian Bunk : 67
Randy> Andrew Morton : 59
Randy> Tejun Heo : 52
Randy> Mariusz Kozlowski : 52
Randy> Paul Mundt : 51
Randy> Ralf Baechle : 50
Randy> ---

With

  git-log --pretty=short v2.6.19.. |  git-shortlog -n -s | head -10

and no additional tools, I get:

    Al Viro: 213
    Linus Torvalds: 94
    Jiri Slaby: 90
    Josef Sipek: 79
    Gerrit Renker: 77
    Adrian Bunk: 67
    Andrew Morton: 59
    Tejun Heo: 52
    Mariusz Kozlowski: 52
    Paul Mundt: 51

Looky there.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

```

## Junio C Hamano, 2006-12-23 04:43

Subject: Re: author/commit counts
Message-ID: <7vfyb7usqd.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vfyb7usqd.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20061222181030.d733deb3.rdunlap@xenotime.net>

```
Randy Dunlap <rdunlap@xenotime.net> writes:

> Is this useful?  or it needs fixing?
> or you already have better solutions?
>
> example:
> git log v2.6.19.. | authorcount -m | less

Perhaps you are talking about this command?

$ git shortlog -n -s v2.6.19..

```

## Linus Torvalds, 2006-12-23 04:44

Subject: Re: author/commit counts
Message-ID: <Pine.LNX.4.64.0612222038570.3671@woody.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0612222038570.3671%40woody.osdl.org
In-Reply-To: <20061223023719.GA8734@spearce.org>

```


On Fri, 22 Dec 2006, Shawn Pearce wrote:
> 
> Here's another variant showing the top 20 committers to git.git,
> no Perl involved:

This is what I've done a few times. For the kernel, I actually find the 
"Signed-off-by:" lines to be more relevant to me (since it shows a 
combination of authorship and maintainership, something that I value a lot 
personally), but I've done statistics on both authors and signers-off )and 
committers, but that mainly just shows who uses git to sync and who does 
not), and I've never written any real scripts for it, I just end up doing 
it with some one-liner shell thing using grep, cut, sort and uniq.

		Linus

```

## Nicolas Pitre, 2006-12-23 05:06

Subject: Re: author/commit counts
Message-ID: <Pine.LNX.4.64.0612230001590.18171@xanadu.home>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0612230001590.18171%40xanadu.home
In-Reply-To: <20061222181030.d733deb3.rdunlap@xenotime.net>

```
On Fri, 22 Dec 2006, Randy Dunlap wrote:

> Hi,
> 
> Someone asked me a few days ago about their patches being merged yet
> (e.g., how to see their commits in a git tree).

See the --author=<string> option to git log.

> Someone else asked (in general) about commit or author counts.
> 
> I pointed the first person to "git log" and/or gitweb.
> For the second, there are probably lots of scripts out there
> but I didn't find them.  Where are they?

Try git shortlog -s.  If you combine the two like:

	git log --author=<blah> | git shortlog -s

then you'll have a commit count for <blah> only.


Nicolas

```

## Randy Dunlap, 2006-12-23 05:24

Subject: Re: author/commit counts
Message-ID: <20061222212449.dd5bf939.rdunlap@xenotime.net>
URL: https://gitlist.dev/e/20061222212449.dd5bf939.rdunlap%40xenotime.net
In-Reply-To: <7vfyb7usqd.fsf@assigned-by-dhcp.cox.net>

```
On Fri, 22 Dec 2006 20:43:54 -0800 Junio C Hamano wrote:

> Randy Dunlap <rdunlap@xenotime.net> writes:
> 
> > Is this useful?  or it needs fixing?
> > or you already have better solutions?
> >
> > example:
> > git log v2.6.19.. | authorcount -m | less
> 
> Perhaps you are talking about this command?
> 
> $ git shortlog -n -s v2.6.19..

Yes, thanks, probably something like that....

git version 1.4.3.GIT

> git shortlog -n -s v2.6.19..
Can't open v2.6.19..: No such file or directory at /usr/local/bin/git-shortlog line 99.

---
~Randy

```

## Randy Dunlap, 2006-12-23 05:27

Subject: Re: author/commit counts
Message-ID: <20061222212710.27cb8396.rdunlap@xenotime.net>
URL: https://gitlist.dev/e/20061222212710.27cb8396.rdunlap%40xenotime.net
In-Reply-To: <86vek3p6s3.fsf@blue.stonehenge.com>

```
On 22 Dec 2006 20:37:00 -0800 Randal L. Schwartz wrote:

> >>>>> "Randy" == Randy Dunlap <rdunlap@xenotime.net> writes:
> 
> Randy> example:
> Randy> git log v2.6.19.. | authorcount -m | less
> 
> Randy> # this is just the ones with >= 50 Author: lines
> 
> Randy> Al Viro : 213
> Randy> Linus Torvalds : 94
> Randy> Jiri Slaby : 90
> Randy> Josef Sipek : 79
> Randy> Gerrit Renker : 77
> Randy> Adrian Bunk : 67
> Randy> Andrew Morton : 59
> Randy> Tejun Heo : 52
> Randy> Mariusz Kozlowski : 52
> Randy> Paul Mundt : 51
> Randy> Ralf Baechle : 50
> Randy> ---
> 
> With
> 
>   git-log --pretty=short v2.6.19.. |  git-shortlog -n -s | head -10
> 
> and no additional tools, I get:
> 
>     Al Viro: 213
>     Linus Torvalds: 94
>     Jiri Slaby: 90
>     Josef Sipek: 79
>     Gerrit Renker: 77
>     Adrian Bunk: 67
>     Andrew Morton: 59
>     Tejun Heo: 52
>     Mariusz Kozlowski: 52
>     Paul Mundt: 51
> 
> Looky there.

Yep, that's nice.  Thanks.

---
~Randy

```

## Shawn Pearce, 2006-12-23 05:29

Subject: Re: author/commit counts
Message-ID: <20061223052929.GA9396@spearce.org>
URL: https://gitlist.dev/e/20061223052929.GA9396%40spearce.org
In-Reply-To: <20061222212449.dd5bf939.rdunlap@xenotime.net>

```
Randy Dunlap <rdunlap@xenotime.net> wrote:
> Yes, thanks, probably something like that....
> 
> git version 1.4.3.GIT
> 
> > git shortlog -n -s v2.6.19..
> Can't open v2.6.19..: No such file or directory at /usr/local/bin/git-shortlog line 99.

The git-shortlog being discussed is the new builtin shortlog,
which has not been released yet.  Try the 'master' branch in git.git.

-- 
Shawn.

```

## Johannes Schindelin, 2006-12-23 14:22

Subject: Re: author/commit counts
Message-ID: <Pine.LNX.4.63.0612231521340.19693@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0612231521340.19693%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <Pine.LNX.4.64.0612230001590.18171@xanadu.home>

```
Hi,

On Sat, 23 Dec 2006, Nicolas Pitre wrote:

> 	git log --author=<blah> | git shortlog -s

Note that the builtin shortlog reuses the fine revision walking machinery:

	git shortlog --author=<blah> -n -s

works like a charm.

Ciao,
Dscho

```

## Johannes Schindelin, 2006-12-23 14:28

Subject: Re: author/commit counts
Message-ID: <loom.20061223T152605-994@post.gmane.org>
URL: https://gitlist.dev/e/loom.20061223T152605-994%40post.gmane.org
In-Reply-To: <20061223023719.GA8734@spearce.org>

```
Shawn Pearce <spearce <at> spearce.org> writes:

>   $ git log | grep ^Author | cut -d\< -f1 | sort \
>   	| uniq -c | sort -n -r | head -20

As Junio pointed out in another mail, "git shortlog -n -s | head -20" is
shorter...

> You can also see the very clear gap between Junio and the rest of the
> world.  There's very little dispute about who really codes Git.  

Note that this still holds when doing the technically correct thing:

$ git shortlog -n -s --no-merges

Ciao,
Dscho

```

## Nicolas Pitre, 2006-12-23 14:31

Subject: Re: author/commit counts
Message-ID: <Pine.LNX.4.64.0612230929410.18171@xanadu.home>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0612230929410.18171%40xanadu.home
In-Reply-To: <Pine.LNX.4.63.0612231521340.19693@wbgn013.biozentrum.uni-wuerzburg.de>

```
On Sat, 23 Dec 2006, Johannes Schindelin wrote:

> Hi,
> 
> On Sat, 23 Dec 2006, Nicolas Pitre wrote:
> 
> > 	git log --author=<blah> | git shortlog -s
> 
> Note that the builtin shortlog reuses the fine revision walking machinery:
> 
> 	git shortlog --author=<blah> -n -s
> 
> works like a charm.

I know and use it myself.  But many people might not have a recent 
enough git version for that.


Nicolas

```
