2

The calendar shows contributions made in the last year. Is there a way to see a similar count but without a start date restriction ?

Shan
  • 1,138
  • 17
  • 32
  • Can you just use the git command line? http://stackoverflow.com/questions/11657295/count-the-number-of-commits-on-a-git-branch or http://gitready.com/intermediate/2009/01/22/count-your-commits.html – Marc Oct 14 '15 at 02:31

2 Answers2

2

Is there a way to see a similar count but without a start date restriction ?

No, but I built git-stats–a tool to track your local commits and show graphs like GitHub does.

An example with my graphs.

Community
  • 1
  • 1
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
2

You can use Github API to retrieve statistics on your repositories and a few lines of code to generate a global count.

Note: There is a pretty low limit in terms of requests for public access. I advise you to generate a token (Settings > Developper settings > Personal access tokens) with Access commit status and Read all user profile data rights.

Here is a small bash script using curl and jq. You just have to change your user name. You can also uncomment the AUTH line and set your generated token to avoid hitting the limit of queries:

#!/bin/bash

# Parameters
USER=jyvet
#AUTH="-u $USER:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

GAPI="https://api.github.com"
REPOS=$(curl $AUTH -s $GAPI/users/$USER/repos | jq -c -r '.[].name')

COMMITS=0
ADDITIONS=0
DELETIONS=0

# Iterate over all the repositories owned by the user
for r in $REPOS; do
    STATS=$(curl $AUTH -s "$GAPI/repos/$USER/$r/stats/contributors" |
            jq ".[] | select(.author.login == \"$USER\")" 2> /dev/null)

    if [ $? -eq 0 ]; then
        tmp=$(echo -n "$STATS" | jq '.total' 2> /dev/null)
        COMMITS=$(( COMMITS + tmp ))

        tmp=$(echo -n "$STATS" | jq '[.weeks[].a] | add' 2> /dev/null)
        ADDITIONS=$(( ADDITIONS + tmp ))

        tmp=$(echo -n "$STATS" | jq '[.weeks[].d] | add' 2> /dev/null)
        DELETIONS=$(( DELETIONS + tmp ))
    fi
done

echo "Commits: $COMMITS, Additions: $ADDITIONS, Deletions: $DELETIONS"

Result:

> Commits: 193, Additions: 20403, Deletions: 2687
jyvet
  • 2,021
  • 15
  • 22