Error: Twitter did not respond. Please wait a few minutes and refresh this page.
The Art of Structured Improvisation. By Carsten Nielsen
Are you interested in the statistics of your project? Who has done how many commits? On which week of the day or hour of day?
Well, here’s some food for you. Simple one-liners for the shell:
The committers-ranking by number of commits.
$> git shortlog -ns
The commits of a project by weekday.
$> for i in Mon Tue Wed Thu Fri Sat Sun; do echo $( echo " $i: "; git shortlog -n --format='%ad %s'| grep "$i " | wc -l); done
The commits of a project by weekday since a defined date. Interesting to see the difference ex. after a project has been released as open-source or the project-team has changed. You can change the option ‘since’ to ‘until’ if you want to count the commits before a defined date.
$> for i in Mon Tue Wed Thu Fri Sat Sun; do echo $( echo " $i: "; git shortlog -n --format='%ad %s' --since='2011-06-31'| grep "$i " | wc -l); done
The commits of a project by hour of day. (Updated after the hint from Patrik. Thanks!)
$> for i in `seq -w 0 23`; do echo $( echo " $i:"; git shortlog -n --format='%ad %s' | grep " $i:" | wc -l); done
The commits of a project by hour of day before a defined date. Even here you can change the option ‘until’ to ‘since’ if needed.
$> for i in `seq -w 0 23`; do echo $( echo " $i:"; git shortlog -n --format='%ad %s' --until='2011-06-31' | grep " $i:" | wc -l); done
With the release of Git v1.7.9 it’s possible to sign your commits now.
To activate this on your machine, you have to configure git:
1. Get your key-id in the terminal:
$> gpg --list-keys ... pub 1024D/123ABC89 2011-09-27 uid Carsten Nielsen ...
Locate your relevant key and copy the ID to git:
$> git config --global user.signingkey 123ABC89
Now you are able to sign your commits by using the option -S
$> git commit -S
If you want to check the origin of a commit you can now show the signing by:
$> git log --show-signature commit 01b817f3e3bfe1fb1143a172539162bf6bf7aca5 gpg: Signature made 2012-02-09T11:30:57 CET using RSA key ID 123ABC89 gpg: Good signature from "Carsten Nielsen " Author: Carsten Nielsen Date: Thu Feb 9 11:30:48 2012 +0100 Lets sign something
With this we should be able to create an infrastructure on the repo- or deploy-server to check and ensure the origin of the commits.
But this is another story for another time…