gitgithubcommand-line

Is there a way to report git contributions on the command line?


I see that github records the commit, add, and delete history for each contributor. You can check it on the graph tab.

However, it's not as granular as I would like.
Is it possible to get this information on the command line?
I'd like to save a more granular dataset in the form of a table.

What I'm thinking of is four arrays: Day/Date, Commits, Additions, Deletions


Solution

  • You can start with using the GitHub Statistics API like:

    Get contributors list with additions, deletions, and commit counts

    It does return:

    total 
    

    The Total number of commits authored by the contributor.

    And: Weekly Hash (weeks array):

    w - Start of the week, given as a Unix timestamp.
    a - Number of additions
    d - Number of deletions
    c - Number of commits
    

    For the command-line aspect, use curl.
    See "A curl tutorial using GitHub's API "


    The above was based on the tag "github", but yes, git itself can generate stats (even fancy ones like the git-stats project)

    See this gist for instance, or use git log --stat, git diff --stat.
    As seen here, some form of processing is needed, to use the result of a

    git log --author=$USER --shortstat $BRANCH