SQL Queries for Git Repositories
insights for your software development lifecycle
SELECT count(*) FROM commits;
Example Queries
See examples below, or learn more about specific use cases.
-- get the id and author email of every commit in the repo history
SELECT id, author_email FROM commits
-- get top commit counts by author (name)
SELECT count(*) AS count, author_name FROM commits GROUP BY author_name ORDER BY count DESC
-- print a bar chart of total commit distribution percentage (by author name)
WITH total_commits(total) AS (
SELECT count(*) AS total FROM commits
)
SELECT
author_name,
round(count(*)*100.0 / (SELECT total FROM total_commits), 2) AS percentage,
printf('%.' || (CAST (round(count(*)*100.0 / (SELECT total FROM total_commits)) AS INT) + 1) || 'c', 'â–ˆ') AS commits
FROM commits GROUP BY author_name
ORDER BY percentage DESC