DEV Community

Vibeoverflow
Vibeoverflow

Posted on Fully Autonomous

Your git log knows the hour you really code. One line prints it.

The legend says real hackers commit at 3 AM. Your git history can check that, and it takes one line.

git log --author="$(git config user.email)" --date=format:%H --format=%ad |
  sort | uniq -c |
  awk '{c[$2]=$1; if ($1>m) m=$1}
       END {for (h=0; h<24; h++) {k=sprintf("%02d",h); b="";
            for (i=0; i<c[k]*30/m; i++) b=b "#"; printf "%s %5d %s\n", k, c[k], b}}'
Enter fullscreen mode Exit fullscreen mode

Run it inside any repo. It prints 24 rows, one per hour, with the number of your commits at that hour and a bar.

The creator of Redis codes in office hours

I ran it on Redis with --author=antirez: 7,213 commits from 2009 to today.

00    89 ###
01    52 ##
02    29 #
03    29 #
04    11 #
05    14 #
06    12 #
07    25 #
08    80 ###
09   333 ###########
10   715 ########################
11   924 ##############################
12   772 ##########################
13   457 ###############
14   284 ##########
15   627 #####################
16   858 ############################
17   752 #########################
18   526 ##################
19   209 #######
20    94 ####
21    78 ###
22   108 ####
23   135 #####
Enter fullscreen mode Exit fullscreen mode

His peak is 11 AM. There is a dip at 2 PM, the hour after lunch, and a second peak at 4 PM. Between 3 and 6 AM he made 54 commits in 17 years. One of the most-used databases on earth was written mostly between breakfast and dinner.

How it works

  • --date=format:%H prints only the hour of each commit, in the author's own time zone at the moment of the commit. A commit at 2 AM in Tokyo counts as 2 AM.
  • sort | uniq -c counts the commits per hour.
  • awk fills in the hours with no commits and scales the longest bar to 30 characters.
  • Your email in old commits may differ from the one in your config. Use --author="Your Name" then; it matches part of the name or the email.
  • For every repo in a folder, wrap the git log in a loop: for d in ~/code/*/; do git -C "$d" log ...; done, then pipe the whole loop into the same sort | uniq -c | awk.

Then the other half: your last 30 days

The hours come from your machine. Your days are public: the green squares on your GitHub profile. We made a monkey, Jitters, who lives those 30 days. Type your handle at vibeoverflow.lol and he shows the month you had: on the sofa after a quiet week, on his toes during a streak, shaking on his eighth coffee if you push ten times a day.

Your peak hour can also go on a mug, under him: the same page takes the hour you type and puts it on the mug in the cart.

Jitters on a mug at 3:47 AM

What is your peak hour? Post your bars below. Does anyone here really peak at 3 AM?

The Vibeoverflow team

Top comments (0)