Visualize Git Data Using SQL
Combine sqliteviz and AskGit to visualize data in git repositories.
AskGit enables SQL queries against data in git repositories. Sqliteviz is a client-side visualization tool for SQLite databases. Marrying the two is pretty easy and makes a lot of sense 🙂.
You can run the
askgit export command to produce a SQLite database file, which can then be loaded into
sqliteviz, to make some cool graphs like this:
…the result of the following SQL query against the Kubernetes source code:
|-- commit counts by author email domain|
|substr(author_email, instr(author_email, '@')+1) AS email_domain -- https://sqlite.org/lang_corefunc.html|
|WHERE parents < 2 -- ignore merge commits|
|GROUP BY email_domain|
|ORDER BY count(*) DESC|
which aggregates the number of commits in a repo by committer email domain - possibly useful as a proxy for how much an organization contributes to a codebase.
The following command will get you a SQLite database with the Kubernetes commit history (from the default branch).
askgit export kubernetes.db -e commits -e "select * from commits('https://github.com/kubernetes/kubernetes')"
Which can then be loaded into
sqliteviz and explored. You can also run queries directly in the browser at try.askgit.com.