Skip to content

Instantly share code, notes, and snippets.

@happyincent
Created February 7, 2025 07:22
Show Gist options
  • Save happyincent/d3f8e8786b1a042be3273edc5d615cba to your computer and use it in GitHub Desktop.
Save happyincent/d3f8e8786b1a042be3273edc5d615cba to your computer and use it in GitHub Desktop.
A Year of Commits stats with mergestat-lite
# https://docs.mergestat.com/blog/2022/01/01/a-year-in-commits
mergestat "SELECT author_email, count(DISTINCT hash) AS commit_count \
, round(count(DISTINCT hash) / (SELECT count(DISTINCT hash)+0.0 FROM commits, stats('', commits.hash) WHERE parents < 2 AND file_path not like '%/apis/%' AND strftime('%Y', author_when) = '2024') * 100, 2) as '%' \
, SUM(additions) AS total_additions \
, round(SUM(additions) / (SELECT SUM(additions)+0.0 FROM commits, stats('', commits.hash) WHERE parents < 2 AND file_path not like '%/apis/%' AND strftime('%Y', author_when) = '2024') * 100, 2) as '%' \
, SUM(deletions) AS total_deletions \
, round(SUM(deletions) / (SELECT SUM(deletions)+0.0 FROM commits, stats('', commits.hash) WHERE parents < 2 AND file_path not like '%/apis/%' AND strftime('%Y', author_when) = '2024') * 100, 2) as '%' \
, count(DISTINCT file_path) AS files_changed \
, round(count(DISTINCT file_path) / (SELECT COUNT(DISTINCT file_path)+0.0 FROM commits, stats('', commits.hash) WHERE parents < 2 AND file_path not like '%/apis/%' AND strftime('%Y', author_when) = '2024') * 100, 2) as '%' \
FROM commits, stats('', commits.hash) WHERE parents < 2 AND file_path not like '%/apis/%' AND strftime('%Y', author_when) = '2024'\
GROUP BY author_email"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment