git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Effectively tracing project contributions with git

From
Jeff King <peff@peff.net>
Date
Sep 13, 2009, 09:24 UTC
Message-ID
<20090913092429.GA14438@coredump.intra.peff.net>
In-Reply-To
<20090913022843.GB26588@mit.edu>
On Sat, Sep 12, 2009 at 10:28:43PM -0400, Theodore Tso wrote:
Show 17 quoted lines
> > I don't see any solution that doesn't see me browsing diffs -- there's
> > no metric that will solve the problem -- but if your stats work could
> > help me get an output of the form 'here are all the diffs on file X by
> > contributor Y in order of size, largest first' then I think it would
> > help a LOT.
> 
> This will display all of the diffs on file (pathname) XXX by contributor YYY:
> 
> 	git log -p --author=YYY XXX 
> 
> You might also find the diffstats useful:
> 
> 	git log --stat --author=YYY XXX
> 
> Or if you want *only* the diffstats for the file in question, you might try:
> 
> 	git log --stat --pretty=format: --author=YYY XXX | grep XXX

There is also the "--numstat" format which is a bit easier for parsing. I think the "all diffs on file $X by contributor $Y, ordered by size" would look like:

  git log -z --pretty=tformat:%H --numstat --author=$Y $X |
  perl -0ne '
    my ($commit) = /^([0-9a-f]{40})$/m;
    my ($lines_added) = /^(\d+)\s/m;
    print "$lines_added $commit\n";
  ' |
  sort -rn |
  cut -d ' ' -f2 |
  xargs -n 1 git show
-Peff
Previous: Theodore TsoNext: Joseph Wakeling
Message 6 of 8 in “Effectively tracing project contributions with git”
  1. Joseph WakelingSep 12, 2009
  2. Jeff KingSep 12, 2009
  3. Sverre RabbelierSep 12, 2009
  4. Joseph WakelingSep 13, 2009
  5. Theodore TsoSep 13, 2009
  6. Jeff KingSep 13, 2009
  7. Joseph WakelingSep 13, 2009
  8. Joseph WakelingSep 13, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.