There's more...

While working with code, it is often useful to know who to go to when you need to perform a fix in the software, especially in an area where you are inexperienced. So, it would be nice to figure out who is the code owner of the file or the files you are changing. The obvious reason is to get some input on the code, but also to know who to go to for a code review. You can again use git shortlog to figure this out. You can use the command on the files as well:

  1. To do this, we simply add the file to the end of the git shortlog command:
$ git shortlog  --numbered --summary --email ./pom.xml 
    86  Matthias Sohn <matthias.sohn@sap.com> 
    21  Shawn O. Pearce <spearce@spearce.org> 
     4  Chris Aniszczyk <caniszczyk@gmail.com> 
 4 Jonathan ...

Get Git Version Control Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.