Personal Git Commit Statistics

Simply make a POST request to track your commits:

This is an example! Please sign in to see your personal URL and API key.

Let's automate this!

Git has so called Git Hooks! Simply put a hook is a script which is executed every time you use a certain git command. With the help of a post-commit hook it's easy to ping the Hulkort API automatically:

# Create the post-commit hook somewhere
mkdir ~/development/git-hooks
cd ~/development/git-hooks
echo '#!/bin/bash' >> post-commit
echo 'curl -d "api_key=3695627b56d99b0eb392131d"' >> post-commit

# Set permissions so it can be executed
chmod 755 post-commit

# Find the folder where Git stores it's templates
# A good place to start looking is '/usr/share/git-core/'
find /usr -type d -name "hooks"

# Link the post-commit hook into your template hooks
cd /usr/share/git-core/templates/hooks
ln -s ~/development/git-hooks/post-commit post-commit

From now on all new Git repositories you create will have the hook and will therefore track your commits. To add the hook to an already existing repository you just run git init again. Git will re-initialize the repository and copy the post-commit hook.

What happened?

In order to get executed a hook has to be in the .git/hooks directory of the repository. Nobody wants to add the post-commit hook by hand to every new repository. Instead we use a template and let Git do all the work.

Whenever you run git init Git will copy the template files into the repositorys .git directory.

So all we have to do is place our post-commit hook in the git-core/templates/hooks directory. To make things clean we just link it, this way we can easily edit the hook anytime.

Example Graph