Skip to content

Instantly share code, notes, and snippets.

@busbey
Last active October 29, 2015 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save busbey/5a9041b194f70f24d885 to your computer and use it in GitHub Desktop.
Save busbey/5a9041b194f70f24d885 to your computer and use it in GitHub Desktop.
"how often is a commit pushed by a different person?"
#!/bin/bash
# "how often is a commit pushed by a different person?"
# or at the least, a different email address.
#
# by convention in RtC projects, git workflows for committers often end up looking like:
# * post patch to jira/reviewboard/phabricator/gerrit
# * other committer +1s
# * committer pushes commit to repo
#
# by contrast, for a non-committer is looks like:
# * post patch to jira/reviewboard/phabricator/gerrit
# * commiter +1s
# * commiter who +1ed pushes commit to repo
#
# So to try to get a rough idea about contributions from non-committers, we look for a
# mismatch between committer and author email addresses.
#
# Notably, will not work on projects that follow github fork-and-PR workflows, since in
# that case both the contribution commits and the merge commit have the same committer
# and author.
#
# Doesn't work if the git repository is just a mirror of svn, or if the project
# doesn't make use of the author field. For example, if the project has committers
# form commits out of the patch with the contributor noted in the commit message text.
#
git log --pretty="%ae %ce" | awk '/([^ ]*) ([^ ]*)/{ if ($1 != $2) { print $1 " committed by " $2 } else { print "own commit" } }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment