Creating Beautiful Github Streaks

Creating Beautiful Github Streaks

Github streaks are a pretty fun and harmless way of visualizing your contributions on github or gitlab. Some people use them to brag a little, some companies use them to check out potential candidates. It’s all good as long as everyone is aware how easily you can manipulate them.

In order to “fake” a commit date in the past, you have to set the GIT_AUTHOR_DATE and GIT_COMMITTER_DATE environment variables on git commit — both, RFC 2822 and ISO 8601 formats are accepted (for more info see here).

When generating hundreds of commits, the --allow-empty flag is very useful, as we don’t have to actually change the source tree in order to generate a commit.

So the command to generate a fake commit looks like this:

GIT_AUTHOR_DATE="$TIMESTAMP" GIT_COMMITTER_DATE="$TIMESTAMP" git commit --allow-empty -m "$TIMESTAMP"

execute it on an empty git repository and push to github or gitlab and you’ll se the result after some time.

To automate this, I wrote me a little python script (github, pypi). You can simply install it via:

pip install python-streak

and run it with:

streak

in an empty git repository. By default, streak will create 3 commits per day with a probability of ~71% per commit for 100 years, starting from 1980-05-09. These parameters can be tuned with:

  • --start START: Beginning of the commits (Format: YYYY-MM-DD)
  • --end END: End of the commits (Format: YYYY-MM-DD)
  • --max MAX: Maximum number of commits per day.
  • --proba PROBA: Probability for a commit to happen.

Generating a few commits per day for the range of 10 years, took roughly 2 minutes on my computer, and man was I a busy beaver in the 80s!

Streak 1989

I know, I’m for sure not the first one to discover this kind of thing, but it was a fun afternoon project anyways!

social